Product Documentation : Ehcache Operations Guide : Monitoring and Management Using JMX : The Management Service
The Management Service
The ManagementService class is the API entry point.
There is only one method, ManagementService.registerMBeans, which is used to initiate JMX registration of a CacheManager's instrumented MBeans. The ManagementService is a CacheManagerEventListener and is therefore notified of any new Caches added or disposed and updates the MBeanServer appropriately.
Initiated MBeans remain registered in the MBeanServer until the CacheManager shuts down, at which time the MBeans are deregistered. This ensures correct behavior in application servers where applications are deployed and undeployed.
* This method causes the selected monitoring options to be be registered
* with the provided MBeanServer for caches in the given CacheManager.
* While registering the CacheManager enables traversal to all of the other
* items, this requires programmatic traversal. The other options allow entry
* points closer to an item of interest and are more accessible from JMX
* management tools like JConsole. Moreover CacheManager and Cache are not
* serializable, so remote monitoring is not possible for CacheManager or
* Cache, while CacheStatistics and CacheConfiguration are.
* Finally, CacheManager and Cache enable management operations to be performed.
* Once monitoring is enabled caches will automatically added and removed from the
* MBeanServer as they are added and disposed of from the CacheManager. When the
* CacheManager itself shutsdown all registered MBeans will be unregistered.
* @param cacheManager the CacheManager to listen to
* @param mBeanServer the MBeanServer to register MBeans to
* @param registerCacheManager Whether to register the CacheManager MBean
* @param registerCaches Whether to register the Cache MBeans
* @param registerCacheConfigurations Whether to register the CacheConfiguration
* @param registerCacheStatistics Whether to register the CacheStatistics MBeans
public static void registerMBeans(
net.sf.ehcache.CacheManager cacheManager,
MBeanServer mBeanServer,
boolean registerCacheManager,
boolean registerCaches,
boolean registerCacheConfigurations,
boolean registerCacheStatistics) throws CacheException {
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback