Class AgentMonitor

java.lang.Object
COM.TIBCO.hawk.console.hawkeye.AgentMonitor
All Implemented Interfaces:
COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener

public class AgentMonitor extends Object implements COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
The AgentMonitor is used to monitor TIB/Hawk agent events.

Events and Listeners

The AgentMonitor delivers two general types of asynchronous events to registered listeners.

  • Subclasses of MonitorEvent are delivered to the subclasses of MonitorListener . They pertain to individual agents and are used to track agent status.
  • Subclasses of ExceptionEvent are delivered to subclasses of ExceptionListener . They report on problems the AgentMonitor encounters during its monitoring activities.

AgentMonitor supports the adding of a single listener object with addXXXListener() methods for the following listener classes:

    AgentMonitorListener           - for notification of agent discovery and expiration
    MicroAgentListMonitorListener  - for notification of microagent add/remove events
    RuleBaseListMonitorListener    - for notification of rulebase add/remove events
    AlertMonitorListener           - to receive all alert related events
    ErrorExceptionListener         - for notification of critical error events relating to the AgenetMonitor's ability to perform monitoring.
    WarningExceptionListener       - for notification of warnnig events relating to the AgentMonitor's ability to perform monitoring.
 
These listeners are part of the following class hierarchy:

They are delivered events from the following event class hierarchy:

The AgentMonitor itself is both thread-safe and thread-aware.

All MonitorEvents are delivered to the listeners in a single message dispatch thread that receives messages from agents and dispatches them to the appropriate event handler methods. The event handler methods of all MonitorListener interfaces are executed serially.

Because the event handler methods run serially, you must ensure that they complete their task and return quickly-without extended computations, and without blocking. If a method must compute at length, we recommend that it spawn a separate thread to complete its task.

Note: The documentation provided with the MonitorListener interface provides additional important information regarding the handling of all MonitorEvent types.

Using the AgentMonitor Class

The correct general procedure for using the AgentMonitor class is:

  1. add any desired event listeners to receive notifications
  2. call initialize() to start the AgentMonitor's monitoring activities
  3. call shutdown() when done
  • Field Details

    • CNAME

      public static String CNAME
    • DEBUG

      public static boolean DEBUG
    • agentMonitorListener

      protected AgentMonitorListener agentMonitorListener
    • nullAgentMonitorListener

      protected AgentMonitorListener nullAgentMonitorListener
    • microAgentListMonitorListener

      protected MicroAgentListMonitorListener microAgentListMonitorListener
    • nullMicroAgentListMonitorListener

      protected MicroAgentListMonitorListener nullMicroAgentListMonitorListener
    • ruleBaseListMonitorListener

      protected RuleBaseListMonitorListener ruleBaseListMonitorListener
    • nullRuleBaseListMonitorListener

      protected RuleBaseListMonitorListener nullRuleBaseListMonitorListener
    • alertMonitorListener

      protected AlertMonitorListener alertMonitorListener
    • nullAlertMonitorListener

      protected AlertMonitorListener nullAlertMonitorListener
    • errorExceptionListener

      protected ErrorExceptionListener errorExceptionListener
    • nullErrorExceptionListener

      protected ErrorExceptionListener nullErrorExceptionListener
    • warningExceptionListener

      protected WarningExceptionListener warningExceptionListener
    • nullWarningExceptionListener

      protected WarningExceptionListener nullWarningExceptionListener
    • isInitialized

      protected boolean isInitialized
    • isShutdown

      protected boolean isShutdown
    • domain

      protected String domain
    • _environment

      protected Hashtable _environment
    • transport

      protected COM.TIBCO.hawk.console.hawkeye.AgentMonitorTransport transport
    • config

      protected Map config
    • agentEventMonitor

      protected COM.TIBCO.hawk.console.nest.console.AgentEventMonitor agentEventMonitor
    • agentTable

      protected Hashtable agentTable
    • provider

      protected COM.TIBCO.hawk.console.hawkeye.Provider provider
  • Constructor Details

    • AgentMonitor

      public AgentMonitor(String hawkDomain, String rvService, String rvNetwork, String rvDaemon, String licenseFile)
      Constructor. The parameters are used to set up the console's communications channel. The hawkDomain and rvService parameters must be the same as the hawk domain and TIB/Rendezvous service configuration parameters used by the agents in order to communicate with them.
      Parameters:
      hawkDomain - the hawk domain on which to communicate
      rvService - the TIB/Rendezvous service parameter to use for console communication. See the TIB/Rendezvous documentation for more information.
      rvNetwork - the TIB/Rendezvous network parameter to use for console communication. See the TIB/Rendezvous documentation for more information.
      rvDaemon - the TIB/Rendezvous daemon parameter to use for console communication. See the TIB/Rendezvous documentation for more information.
    • AgentMonitor

      public AgentMonitor(String hawkDomain, String serverURL, String clientId, String userName, String password, Hashtable environment, String licenseFile)
    • AgentMonitor

      public AgentMonitor(String hawkDomain, String serverURL, Hashtable environment, String licenseFile)
    • AgentMonitor

      public AgentMonitor(String hawkDomain, String host, int port, int tunnelMode)
    • AgentMonitor

      public AgentMonitor()
    • AgentMonitor

      public AgentMonitor(Map config)
  • Method Details

    • initialize

      public void initialize() throws ConsoleInitializationException
      Initializes the AgentMonitor. May not be called more than once per AgentMonitor instance.
      Throws:
      ConsoleInitializationException - if some intialization error occurred
      IllegalStateException - if called more than once.
    • getLicenseSettings

      public String getLicenseSettings()
      Deprecated.
      as of TIB/Hawk version 3.1.0
      Used to retrieve license settings.
      Throws:
      IllegalStateException - if called before initialize()
    • shutdown

      public void shutdown()
      Used to gracefully shutdown the AgentMonitor. Calling this method more than once has no effect.
      Throws:
      IllegalStateException - if called before initialize()
    • addAgentMonitorListener

      public void addAgentMonitorListener(AgentMonitorListener l) throws TooManyListenersException
      Adds a AgentMonitorListener to the console.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeAgentMonitorListener

      public void removeAgentMonitorListener(AgentMonitorListener l)
      Removes an AgentMonitorListener.
      Throws:
      IllegalStateException - if called after initialize()
    • addMicroAgentListMonitorListener

      public void addMicroAgentListMonitorListener(MicroAgentListMonitorListener l) throws TooManyListenersException
      Adds a MicroAgentListMonitorListener.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeMicroAgentListMonitorListener

      public void removeMicroAgentListMonitorListener(MicroAgentListMonitorListener l)
      Removes a MicroAgentListMonitorListener.
      Throws:
      IllegalStateException - if called after initialize()
    • addRuleBaseListMonitorListener

      public void addRuleBaseListMonitorListener(RuleBaseListMonitorListener l) throws TooManyListenersException
      Adds a RuleBaseListMonitorListener.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeRuleBaseListMonitorListener

      public void removeRuleBaseListMonitorListener(RuleBaseListMonitorListener l)
      Removes a RuleBaseListMonitorListener.
      Throws:
      IllegalStateException - if called after initialize()
    • addAlertMonitorListener

      public void addAlertMonitorListener(AlertMonitorListener l) throws TooManyListenersException
      Adds a AlertMonitorListener.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeAlertMonitorListener

      public void removeAlertMonitorListener(AlertMonitorListener l)
      Removes a AlertMonitorListener.
      Throws:
      IllegalStateException - if called after initialize()
    • addErrorExceptionListener

      public void addErrorExceptionListener(ErrorExceptionListener l) throws TooManyListenersException
      Adds an ErrorExceptionListener.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeErrorExceptionListener

      public void removeErrorExceptionListener(ErrorExceptionListener l)
      Removes an ErrorExceptionListener.
      Throws:
      IllegalStateException - if called after initialize()
    • addWarningExceptionListener

      public void addWarningExceptionListener(WarningExceptionListener l) throws TooManyListenersException
      Adds a WarningExceptionListener.
      Throws:
      IllegalStateException - if called after initialize() or after shutdown()
      TooManyListenersException - if a listener is already registered
    • removeWarningExceptionListener

      public void removeWarningExceptionListener(WarningExceptionListener l)
      Removes a WarningExceptionListener.
      Throws:
      IllegalStateException - if called after initialize()
    • checkInitState

      protected void checkInitState(String methodName, boolean assertedInitializationState)
      Helper method. Checks the asserted initialization state and throws an IllegalStateException if isInitialized doesn't match it.
      Parameters:
      methodName - the name of the calling method.
      assertedInitializationState - the asserted initialization state of the console. This is the assertion being checked.
      Throws:
      IllegalStateException - if called before initialize()
    • checkShutdownState

      protected void checkShutdownState()
      Helper method. Simply throws an IllegalStateException if AgentMonitor has already been shutdown. Used by all methods that can't be invoked after a shutdown. (all but shutdown itself).
      Throws:
      IllegalStateException - if called after shutdown();
    • setEncoding

      public void setEncoding(String encoding) throws UnsupportedEncodingException
      Throws:
      UnsupportedEncodingException
    • setFatalErrorCallBack

      public void setFatalErrorCallBack(COM.TIBCO.hawk.util.TransportFatalCallBack callback)
    • setRecoveryCallBack

      public void setRecoveryCallBack(COM.TIBCO.hawk.util.TransportRecoveryCallBack callback)
    • onAgentInitialEvent

      public void onAgentInitialEvent(COM.TIBCO.hawk.console.nest.shared.AgentInitialMsg msg)
      Specified by:
      onAgentInitialEvent in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • onAgentExpiredEvent

      public void onAgentExpiredEvent(COM.TIBCO.hawk.console.nest.shared.AgentExpiredMsg msg)
      Specified by:
      onAgentExpiredEvent in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • onMicroAgentEvent

      public void onMicroAgentEvent(COM.TIBCO.hawk.console.nest.shared.MicroAgentEventMsg msg)
      Specified by:
      onMicroAgentEvent in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • onRuleBaseEvent

      public void onRuleBaseEvent(COM.TIBCO.hawk.console.nest.shared.RuleBaseEventMsg msg)
      Specified by:
      onRuleBaseEvent in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • onInternalConsoleError

      public void onInternalConsoleError(String msg)
      Specified by:
      onInternalConsoleError in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • onInternalConsoleWarning

      public void onInternalConsoleWarning(String msg)
      Specified by:
      onInternalConsoleWarning in interface COM.TIBCO.hawk.console.nest.console.AgentEventMonitorListener
    • getDomainName

      public String getDomainName()