ehcache

net.sf.ehcache.management.sampled
Class SampledMBeanRegistrationProvider

java.lang.Object
  extended by net.sf.ehcache.management.sampled.SampledMBeanRegistrationProvider
All Implemented Interfaces:
CacheManagerEventListener, MBeanRegistrationProvider

public class SampledMBeanRegistrationProvider
extends Object
implements MBeanRegistrationProvider, CacheManagerEventListener

An implementation of MBeanRegistrationProvider which registers sampled MBeans for the CacheManager and its Caches. This also implements CacheManagerEventListener to add/remove/cleanup MBeans for new caches added or removed

Since:
1.7
Author:
Abhishek Sanoujam

Constructor Summary
SampledMBeanRegistrationProvider()
          Default constructor
 
Method Summary
 void dispose()
          Stop the listener and free any resources.
 Status getStatus()
          Returns the listener status.
 void init()
          CacheManagerEventListener.init() - no need to do anything here
 void initialize(CacheManager cacheManagerParam, ClusteredInstanceFactory clusteredInstanceFactory)
          Initialize MBeanRegistration if necessary for the cacheManager
 boolean isAlive()
          Returns true if this SampledMBeanRegistrationProvider is alive
 boolean isInitialized()
          Returns true if initialized otherwise false
 void notifyCacheAdded(String cacheName)
          Called immediately after a cache has been added and activated.
 void notifyCacheRemoved(String cacheName)
          Called immediately after a cache has been disposed and removed.
 void reinitialize(ClusteredInstanceFactory clusteredInstanceFactory)
          Reinitialize the mbeans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampledMBeanRegistrationProvider

public SampledMBeanRegistrationProvider()
Default constructor

Method Detail

initialize

public void initialize(CacheManager cacheManagerParam,
                       ClusteredInstanceFactory clusteredInstanceFactory)
Initialize MBeanRegistration if necessary for the cacheManager

Specified by:
initialize in interface MBeanRegistrationProvider

reinitialize

public void reinitialize(ClusteredInstanceFactory clusteredInstanceFactory)
                  throws MBeanRegistrationProviderException
Reinitialize the mbeans. Uses the current name of the CacheManager to re-register the mbeans

Specified by:
reinitialize in interface MBeanRegistrationProvider
Throws:
MBeanRegistrationProviderException

isInitialized

public boolean isInitialized()
Returns true if initialized otherwise false

Specified by:
isInitialized in interface MBeanRegistrationProvider
Returns:
true if initialized

init

public void init()
          throws CacheException
CacheManagerEventListener.init() - no need to do anything here

Specified by:
init in interface CacheManagerEventListener
Throws:
CacheException - - all exceptions are wrapped in CacheException

getStatus

public Status getStatus()
Returns the listener status.

Specified by:
getStatus in interface CacheManagerEventListener
Returns:
the status at the point in time the method is called

dispose

public void dispose()
             throws CacheException
Stop the listener and free any resources. Removes registered ObjectNames

Specified by:
dispose in interface CacheManagerEventListener
Throws:
CacheException - - all exceptions are wrapped in CacheException

isAlive

public boolean isAlive()
Returns true if this SampledMBeanRegistrationProvider is alive

Returns:
true if alive otherwise false

notifyCacheAdded

public void notifyCacheAdded(String cacheName)
Called immediately after a cache has been added and activated.

Specified by:
notifyCacheAdded in interface CacheManagerEventListener
Parameters:
cacheName - the name of the Cache the operation relates to
See Also:
CacheEventListener

notifyCacheRemoved

public void notifyCacheRemoved(String cacheName)
Called immediately after a cache has been disposed and removed. The calling method will block until this method returns.

Specified by:
notifyCacheRemoved in interface CacheManagerEventListener
Parameters:
cacheName - the name of the Cache the operation relates to

ehcache

Copyright 2001-2017, Terracotta, Inc.