Class BrokerMonitorClient


  • public class BrokerMonitorClient
    extends java.lang.Object
    Representation of a Broker Monitor client.

    Many calls throw "communications exception". These exceptions are:

    BrokerCommFailureException
    If a networking error occurs.
    BrokerConnectionClosedException
    If the Broker Monitor disconnects from the application.
    BrokerProtocolException
    If an error occurs during communication between the Broker Monitor and the application.
    BrokerTimeoutException
    If the request was not handled at a reasonable time. Most operations use the default timeout of 30 seconds.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()
      Destroys the Broker Monitor client.
      java.lang.String getHostName()
      Get the host name of Broker Monitor.
      int getPort()
      Get the port being used by the Broker Monitor.
      BrokerServerLogEntry[] getServerLogEntries​(int base_port, BrokerDate first_entry, java.lang.String locale, int num_entries)
      Get a set of server log entries, for the server listening on the given base port number.
      BrokerServerLogInfo getServerLogStatus​(int base_port)
      Get the server log status, for the server listening on the given base port number.
      int getServerRunStatus​(int port)
      Specifies whether the Broker Server is online, stopped, starting, stopping, unresponsive, failed, or unknown.
      BrokerServerInfo[] getServers()
      Get the configuration details of all Broker Servers on the host.
      java.lang.String getVersion()
      Get the version of the Broker Monitor.
      int getVersionNumber()
      Get Broker Monitor's version number.
      void pruneMonitorLog​(int base_port, BrokerDate older_than)
      Delete entries from the Broker Monitor's log.
      void reloadConfig()
      Make Broker Monitor to re-load its configuration for all the servers.
      void reloadConfigForServer​(int port)
      Make Broker Monitor to re-read its configuration for the specified server.
      void startServer​(int port)
      Start a server.
      java.lang.String toString()
      Get Broker Monitor client information in a form suitable for human viewing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BROKER_MONITOR_DEFAULT_PORT

        public static final int BROKER_MONITOR_DEFAULT_PORT
        See Also:
        Constant Field Values
    • Constructor Detail

      • BrokerMonitorClient

        public BrokerMonitorClient​(java.lang.String broker_monitor_host)
                            throws BrokerException
        Create a Broker Monitor client. A Broker Monitor client is used by administration applications to manage Broker Servers. When creating a BrokerMonitorClient, you don't have to pass a port number. The broker_monitor_host parameter should contain the name of the system on which your enterprise server is running. If you does not pass a port number, default port, BROKER_MONITOR_DEFAULT_PORT will be used. Make sure the Broker Monitor process is running before creating the BrokerMonitorClient object.
        Throws:
        BrokerCommFailureException - If problems occur while establishing the connection.
        BrokerHostNotFoundException - If the specified host does not exist.
        BrokerNotRunningException - If the host exists but no Broker Monitor is running on that host.
        BrokerNullParameterException - If broker_host is null.
        BrokerException
      • BrokerMonitorClient

        public BrokerMonitorClient​(java.lang.String broker_monitor_host,
                                   BrokerConnectionDescriptor desc)
                            throws BrokerException
        Create a Broker Monitor client. A Broker Monitor client is used by administration applications to manage Broker Servers. When creating a BrokerMonitorClient, you don't have to pass a port number. The broker_monitor_host parameter should contain the name of the system on which your enterprise server is running. If you does not pass a port number, default port, BROKER_MONITOR_DEFAULT_PORT will be used . Make sure the Broker Monitor process is running before creating the BrokerMonitorClient object.
        Throws:
        BrokerCommFailureException - If problems occur while establishing the connection.
        BrokerHostNotFoundException - If the specified host does not exist.
        BrokerNotRunningException - If the host exists but no Broker Monitor is running on that host.
        BrokerNullParameterException - If broker_host is null.
        BrokerInvalidPortException - If the monitor port is invalid.
        BrokerException
    • Method Detail

      • destroy

        public void destroy()
                     throws BrokerException
        Destroys the Broker Monitor client. Disconnects from the Broker Monitor. May throw any communications exception, but the local client object is marked as disconnected even if an exception is thrown.
        Throws:
        BrokerInvalidClientException - If the client has been destroyed.
        BrokerException
      • getHostName

        public java.lang.String getHostName()
        Get the host name of Broker Monitor.
      • getPort

        public int getPort()
        Get the port being used by the Broker Monitor.
      • getServerRunStatus

        public int getServerRunStatus​(int port)
                               throws BrokerException
        Specifies whether the Broker Server is online, stopped, starting, stopping, unresponsive, failed, or unknown. The state can be any of the following values: SERVER_STATUS_RUNNING SERVER_STATUS_STOPPED SERVER_STATUS_STARTING SERVER_STATUS_STOPPING SERVER_STATUS_ERROR SERVER_STATUS_FAILED SERVER_STATUS_UNKNOWN
        Throws:
        BrokerInvalidClientException - If the client has been destroyed.
        BrokerUnknownServerException - If no server is configured on the specified port.
        BrokerException
      • reloadConfig

        public void reloadConfig()
                          throws BrokerException
        Make Broker Monitor to re-load its configuration for all the servers.
        Throws:
        BrokerException
      • getVersionNumber

        public int getVersionNumber()
        Get Broker Monitor's version number. Returns one of the BrokerClient.VERSION_* constant values.

        If Broker Monitor is newer than Broker Monitor client's version, Broker Monitor client's version is reported.

      • getServerLogEntries

        public BrokerServerLogEntry[] getServerLogEntries​(int base_port,
                                                          BrokerDate first_entry,
                                                          java.lang.String locale,
                                                          int num_entries)
                                                   throws BrokerException
        Get a set of server log entries, for the server listening on the given base port number. You supply the date for the first entry you are interested in, and you can provide a maximum number of entries to receive. If num_entries is '-1' then it gets all entries. Note that getting all entries can be a performance and/or memory problem. If first_entry is null, returns entries starting from the beginning of the log. locale can be used to request a specific locale. If NULL, then the server's default locale is used. The server's default locale is also used if you request a locale that the server does not support.
        Throws:
        BrokerInvalidClientException - If the client has been destroyed.
        BrokerIncompatibleVersionException - If the version of the Broker is not known to this operation.
        BrokerOutOfRangeException - If num_entries is less than -1.
        BrokerNoPermissionException - If the client has limited access.
        BrokerException
      • toString

        public java.lang.String toString()
        Get Broker Monitor client information in a form suitable for human viewing. Returns null if the Broker Monitor client is not valid.
        Overrides:
        toString in class java.lang.Object