Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 Note: The JMX manager requires the custom MBean CustomMXBean interface and class to be on its classpath.

Code Block
languagejava
titleRegister and Federate MBean
// Get the ManagementService
Cache cache = ...;
ManagementService service = ManagementService.getManagementService(cache);

// Create the MBean. The domain specified doesn't matter (as long as there is one). It will be replaced by the 'GemFire' domain.
CustomMXBean bean = new CustomMBean();
ObjectName beanName = ObjectName.getInstance("GemFire:type=Member,name=Custom");

// Register the MBean. The GemFire ObjectName will be something like: GemFire:type=Member,name=Custom,member=192.168.2.13(68439)<v22>-8504
ObjectName gemfireBeanName = service.registerMBean(bean, beanName);

// Federate the MBean. This causes its values to periodically be sent to the JMX manager.
service.federate(gemfireBeanName, CustomMXBean.class, false);

...