Class SampledMBeanRegistrationProvider
- java.lang.Object
-
- net.sf.ehcache.management.sampled.SampledMBeanRegistrationProvider
-
- All Implemented Interfaces:
CacheManagerEventListener,MBeanRegistrationProvider
public class SampledMBeanRegistrationProvider extends java.lang.Object implements MBeanRegistrationProvider, CacheManagerEventListener
An implementation ofMBeanRegistrationProviderwhich registers sampled MBeans for the CacheManager and its Caches. This also implementsCacheManagerEventListenerto add/remove/cleanup MBeans for new caches added or removed- Since:
- 1.7
- Author:
- Abhishek Sanoujam
-
-
Constructor Summary
Constructors Constructor Description SampledMBeanRegistrationProvider()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Stop the listener and free any resources.StatusgetStatus()Returns the listener status.voidinit()CacheManagerEventListener.init() - no need to do anything herevoidinitialize(CacheManager cacheManagerParam, ClusteredInstanceFactory clusteredInstanceFactory)Initialize MBeanRegistration if necessary for the cacheManagerbooleanisAlive()Returns true if thisSampledMBeanRegistrationProvideris alivebooleanisInitialized()Returnstrueif initialized otherwise falsevoidnotifyCacheAdded(java.lang.String cacheName)Called immediately after a cache has been added and activated.voidnotifyCacheRemoved(java.lang.String cacheName)Called immediately after a cache has been disposed and removed.voidreinitialize(ClusteredInstanceFactory clusteredInstanceFactory)Reinitialize the mbeans.
-
-
-
Method Detail
-
initialize
public void initialize(CacheManager cacheManagerParam, ClusteredInstanceFactory clusteredInstanceFactory)
Initialize MBeanRegistration if necessary for the cacheManager- Specified by:
initializein interfaceMBeanRegistrationProvider
-
reinitialize
public void reinitialize(ClusteredInstanceFactory clusteredInstanceFactory) throws MBeanRegistrationProviderException
Reinitialize the mbeans. Uses the current name of theCacheManagerto re-register the mbeans- Specified by:
reinitializein interfaceMBeanRegistrationProvider- Throws:
MBeanRegistrationProviderException
-
isInitialized
public boolean isInitialized()
Returnstrueif initialized otherwise false- Specified by:
isInitializedin interfaceMBeanRegistrationProvider- Returns:
trueif initialized
-
init
public void init() throws CacheExceptionCacheManagerEventListener.init() - no need to do anything here- Specified by:
initin interfaceCacheManagerEventListener- Throws:
CacheException- - all exceptions are wrapped in CacheException
-
getStatus
public Status getStatus()
Returns the listener status.- Specified by:
getStatusin interfaceCacheManagerEventListener- Returns:
- the status at the point in time the method is called
-
dispose
public void dispose() throws CacheExceptionStop the listener and free any resources. Removes registered ObjectNames- Specified by:
disposein interfaceCacheManagerEventListener- Throws:
CacheException- - all exceptions are wrapped in CacheException
-
isAlive
public boolean isAlive()
Returns true if thisSampledMBeanRegistrationProvideris alive- Returns:
- true if alive otherwise false
-
notifyCacheAdded
public void notifyCacheAdded(java.lang.String cacheName)
Called immediately after a cache has been added and activated.- Specified by:
notifyCacheAddedin interfaceCacheManagerEventListener- Parameters:
cacheName- the name of theCachethe operation relates to- See Also:
CacheEventListener
-
notifyCacheRemoved
public void notifyCacheRemoved(java.lang.String cacheName)
Called immediately after a cache has been disposed and removed. The calling method will block until this method returns.- Specified by:
notifyCacheRemovedin interfaceCacheManagerEventListener- Parameters:
cacheName- the name of theCachethe operation relates to
-
-