This section describes the following steps for configuring custom MBeans.
Custom MBeans are configured in an XML configuration file. The elements in the file describe the MBean type, MBean implementation, and the target MBean ObjectName. The current release of Coherence supports these types of custom MBeans.
The MBean reference provides complete descriptions of the elements used in this section.
The following example will create a Coherence:type=Query,nodeId=<nodeId> using the standard MBean com.oracle.customMBeans.Query class for the node. This example specifies an MBean class (mbean-class), an MBean name (mbean-name), and whether it is registered (enabled) in the instance.
The following example will execute the standard Java method getMemoryMXBean in the java.lang.management.ManagementFactory class and use the result to create a Coherence:type=java,SubSystem=Memory,nodeId=<nodeId> for the node. the example specifies an MBean factory (mbean-factory), an accessor method name on the factory (mbean-accessor), an MBean name (mbean-name), and whether it is registered (enabled) in the instance.
JMX MBeans are MBeans that exist in a local MBean server that need to be added to the Coherence Management structure. This allows consolidation of MBeanServer information into a single source. The following example executes the JMX query, java.lang:*, on the node's local MBean server and uses the results to create corresponding MBeans on the centralized Coherence MBean server. The example specifies a JMX MBean query (mbean-query), an MBean name (mbean-name), and whether it is registered (enabled) in the instance.
You can enable the custom MBean configuration file by setting a system property or by including a specially named file in the class path.
Coherence provides the following system property to specify the name and location of a custom MBean configuration file. Setting this system property will cause the Coherence node to load the MBeans defined in the file represented by filename.
By convention, Coherence recognizes the configuration file named custom-mbeans.xml as containing a custom MBean configuration. If you name your custom MBean configuration file custom-mbeans.xml and include it in the class path, then the Coherence node will load the configured MBeans.