Class MBeanConnector


public class MBeanConnector extends MBeanHelper
Utility class to expose Coherence JMX MBeans via the Sun JMX reference implementation HtmlAdaptorServer or a JMX Remote JMXConnectorServer.

In order to use this class, the following system property may need to be set on the monitored cluster nodes (i.e. cache servers):

   -Dcoherence.management.remote=true
 
The following properties may be used for configuration of the monitoring node:
Monitoring properties
coherence.management Specifies if a cluster node's JVM has an in-process MBeanServer and if this node allows management of other nodes' managed objects. Use all to specify management of this and all other remotely manageable cluster nodes
coherence.management.remote.host The host that the JMX server will bind to. Default is localhost.
coherence.management.remote.registryport The port used for the JMX RMI registry. Default is 9000.
coherence.management.remote.connectionport The port used for the JMX RMI connection. Default is ephemeral.
coherence.management.remote.httpport The port used for the HTTP connection. Default is 8888.
Since:
Coherence 3.3
Author:
pperalta 2007.02.01
  • Field Details

    • HELP_COMMAND_LINE_ARG

      public static final String HELP_COMMAND_LINE_ARG
      Command line argument used to output usage.
      See Also:
    • RMI_COMMAND_LINE_ARG

      public static final String RMI_COMMAND_LINE_ARG
      Command line argument to start RMI server.
      See Also:
    • HTTP_COMMAND_LINE_ARG

      public static final String HTTP_COMMAND_LINE_ARG
      Command line argument to start HTTP server.
      See Also:
    • VALID_COMMANDS

      public static final String[] VALID_COMMANDS
      Array that contains all valid command line arguments.
    • RMI_HOST_PROPERTY

      public static final String RMI_HOST_PROPERTY
      Property name to specify the RMI host.
      See Also:
    • RMI_CONNECTION_PORT_PROPERTY

      public static final String RMI_CONNECTION_PORT_PROPERTY
      Property name to specify RMI connection port.
      See Also:
    • RMI_CONNECTION_PORT_ADJUST_PROPERTY

      public static final String RMI_CONNECTION_PORT_ADJUST_PROPERTY
      Property name to specify RMI connection max port.
      See Also:
    • RMI_REGISTRY_PORT_PROPERTY

      public static final String RMI_REGISTRY_PORT_PROPERTY
      Property name to specify RMI registry port.
      See Also:
    • RMI_CUSTOM_AUTHENTICATOR_PROPERTY

      public static final String RMI_CUSTOM_AUTHENTICATOR_PROPERTY
      Property name to specify custom RMI Authenticator.
      See Also:
    • HTTP_PORT_PROPERTY

      public static final String HTTP_PORT_PROPERTY
      Property name to specify HTTP port.
      See Also:
    • DEFAULT_RMI_HOST

      public static final String DEFAULT_RMI_HOST
      Default RMI host (wildcard).
      See Also:
    • DEFAULT_RMI_CONNECTION_PORT

      public static final int DEFAULT_RMI_CONNECTION_PORT
      Default RMI connection port (0 ephemeral).
      See Also:
    • DEFAULT_RMI_REGISTRY_PORT

      public static final int DEFAULT_RMI_REGISTRY_PORT
      Default RMI registry port (9000).
      See Also:
    • DEFAULT_HTTP_PORT

      public static final int DEFAULT_HTTP_PORT
      Default HTTP port (8888).
      See Also:
  • Constructor Details

    • MBeanConnector

      public MBeanConnector()
  • Method Details

    • main

      public static void main(String[] asArg) throws Exception
      Start a Coherence cluster node that enables JMX agents such as a web browser or JConsole to connect to the in-process JMX MBeanServer and manage Coherence MBeans.

      Command line usage:

      java com.tangosol.net.management.MBeanConnector [-rmi] and/or [-http]

      Use the following command to connect via JConsole when using the -rmi flag:

      jconsole service:jmx:rmi://[host]:[RMI Connection port]/jndi/rmi://[host]:[RMI Registry port]/server

      To connect via a web browser when using the -http flag:

      http://[host]:[HTTP port]

      Parameters:
      asArg - the command line arguments
      Throws:
      Exception - if an error occurs
    • start

      public void start(boolean fRmi, boolean fHttp)
      Start the RMI and/or HTTP agents.
      Parameters:
      fRmi - if true starts the RMI agent
      fHttp - if true starts the HTTP agent
    • startRmiConnector

      public JMXConnectorServer startRmiConnector() throws IOException
      Starts the RMI connector using the values of the RMI_* system properties.
      Returns:
      a JMXConnectorServer that has been started
      Throws:
      IOException - if an I/O error occurs
      See Also:
    • getHostName

      public static String getHostName()
      Get the configured host name for the RMI Connector Server.
      Returns:
      the configured host name for the RMI Connector Server
    • getRegistryPort

      public static int getRegistryPort()
      Get the configured registry port for the RMI Connector Server.
      Returns:
      the configured registry port for the RMI Connector Server
    • getConnectionPort

      public static int getConnectionPort()
      Get the configured connection port for the RMI Connector Server.
      Returns:
      the configured connection port for the RMI Connector Server
    • getConnectionPortMax

      public static int getConnectionPortMax()
      Get the max configured connection port for the RMI Connector Server.
      Returns:
      the max configured connection port for the RMI Connector Server
    • getRMIConnectorAttributes

      public static Map getRMIConnectorAttributes()
      Get the attributes for the RMI Connector Server.
      Returns:
      a set of attributes to control the RMI connector server's behavior
    • startHttpConnector

      public Object startHttpConnector()
      Starts the HTTP connector using the values of the HTTP_* system properties.
      Returns:
      a com.sun.jdmk.comm.HtmlAdaptorServer that has been started
      See Also:
    • showUsage

      public static void showUsage()
      Output usage instructions.