net.sf.ehcache.event
Interface CacheManagerEventListener
- All Known Subinterfaces: 
- CacheManagerPeerListener
- All Known Implementing Classes: 
- CacheManagerEventListenerRegistry, EhcacheHibernateMBeanRegistrationImpl, ManagementService, RMICacheManagerPeerListener, SampledMBeanRegistrationProvider
- public interface CacheManagerEventListener 
Allows implementers to register callback methods that will be executed when a
 CacheManager event occurs.
 The lifecycle events are:
 
 - init
 
- dispose
 
CacheManager change events are:
 - adding a Cache
- removing a Cache
Note that the caches that are part of the initial configuration are not considered "changes".
 It is only caches added or removed beyond the initial config.
 Callbacks to these methods are synchronous and unsynchronized. It is the responsibility of
 the implementer to safely handle the potential performance and thread safety issues
 depending on what their listener is doing.
- Since:
- 1.2
- Version:
- $Id: CacheManagerEventListener.java 5594 2012-05-07 16:04:31Z cdennis $
- Author:
- Greg Luck
- See Also:
- CacheEventListener
| Method Summary | 
|  void | dispose()Stop the listener and free any resources.
 | 
|  Status | getStatus()Returns the listener status.
 | 
|  void | init()Call to start the listeners and do any other required initialisation.
 | 
|  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.
 | 
 
init
void init()
          throws CacheException
- Call to start the listeners and do any other required initialisation.
 init should also handle any work to do with the caches that are part of the initial configuration.
 
- 
- Throws:
- CacheException- - all exceptions are wrapped in CacheException
 
getStatus
Status getStatus()
- Returns the listener status.
 
- 
- Returns:
- the status at the point in time the method is called
 
dispose
void dispose()
             throws CacheException
- Stop the listener and free any resources.
 
- 
- Throws:
- CacheException- - all exceptions are wrapped in CacheException
 
notifyCacheAdded
void notifyCacheAdded(String cacheName)
- Called immediately after a cache has been added and activated.
 
 Note that the CacheManager calls this method from a synchronized method. Any attempt to
 call a synchronized method on CacheManager from this method will cause a deadlock.
 
 Note that activation will also cause a CacheEventListener status change notification
 from Status.STATUS_UNINITIALISEDtoStatus.STATUS_ALIVE. Care should be taken on processing that
 notification because:
 - the cache will not yet be accessible from the CacheManager.
 
- the addCaches methods which cause this notification are synchronized on the
 CacheManager. An attempt to call CacheManager.getEhcache(String)will cause a deadlock.
 The calling method will block until this method returns.
 
- 
- Parameters:
- cacheName- the name of the- Cachethe operation relates to
- See Also:
- CacheEventListener
 
notifyCacheRemoved
void notifyCacheRemoved(String cacheName)
- Called immediately after a cache has been disposed and removed. The calling method will
 block until this method returns.
 
 Note that the CacheManager calls this method from a synchronized method. Any attempt to
 call a synchronized method on CacheManager from this method will cause a deadlock.
 
 Note that a CacheEventListenerstatus changed will also be triggered. Any
 attempt from that notification to access CacheManager will also result in a deadlock.
 
- 
- Parameters:
- cacheName- the name of the- Cachethe operation relates to
 
Copyright 2001-2015, Terracotta, Inc.