29 How to Manage Custom MBeans Within the Cluster

In addition to managing Coherence with JMX, Coherence provides the ability to manage and monitor "custom MBeans" (that is, application-level MBeans) within the Coherence JMX Management and Monitoring framework. This enables you to manage or monitor any application-level MBean from any JVM, node, or end-point within the cluster.

In addition to the standard Coherence managed object types, any dynamic or standard MBean type may be registered using the com.tangosol.net.management.Registry interface.

29.1 Custom MBean Configuration

Coherence 3.4 can be configured to load platform and standard MBeans on connection to the cluster. This allows administrators and support personnel to update and view system and application information from all nodes in a cluster from a single location. This feature also eliminates the need for JMX programs to connect to multiple sources to gather information.

29.1.1 How to Add a Standard MBean to Coherence

The following instructions describe how to add a standard MBean to Coherence:

  1. Create a standard MBean.

  2. Add a standard MBean Class or JAR to the Coherence classpath (including central management node).

  3. Create a custom MBean XML configuration file (see "Creating an MBean XML Configuration File").

  4. Modify node startup scripts to reference custom-mbean.xml (see "Enabling a Custom MBean Configuration File".

29.1.2 How to Programatically Add a Standard MBean to Coherence

Example 29-1 illustrates sample code that programmatically adds a standard MBean to Coherence.

Example 29-1 Adding a Standard MBean to Coherence Programatically

Registry    registry = CacheFactory.ensureCluster().getManagement();
Custom      bean     = new Custom();
String      sName    = registry.ensureGlobalName("type=Custom");

registry.register(sName, bean);

29.1.3 How to Add a the Results of a JMX Query to Coherence

The following instructions describe how to add the results of a JMX query to Coherence.

  1. Create a custom MBean XML file (see "Creating an MBean XML Configuration File").

  2. Configure node startup script to include JMX MBean Server

  3. Configure a node startup script to reference custom-mbean.xml (see "Enabling a Custom MBean Configuration File").

Figure 29-1 illustrates an example of running a JMX Query in JConsole.

Figure 29-1 JMX Query Run in JConsole

Description of Figure 29-1 follows
Description of "Figure 29-1 JMX Query Run in JConsole"