public class CacheManagerEventListenerRegistry extends Object implements CacheManagerEventListener
There is one of these per CacheManager. It is a composite listener.
| Constructor and Description |
|---|
CacheManagerEventListenerRegistry()
Construct a new registry
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Tell listeners to dispose themselves.
|
Set |
getRegisteredListeners()
Gets a Set of the listeners registered to this class
|
Status |
getStatus()
Returns the listener status.
|
boolean |
hasRegisteredListeners()
Returns whether or not at least one cache manager event listeners has been registered.
|
void |
init()
Initialises the listeners, ready to receive events.
|
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.
|
boolean |
registerListener(CacheManagerEventListener cacheManagerEventListener)
Adds a listener to the notification service.
|
String |
toString()
Returns a string representation of the object.
|
boolean |
unregisterListener(CacheManagerEventListener cacheManagerEventListener)
Removes a listener from the notification service.
|
public CacheManagerEventListenerRegistry()
public final boolean registerListener(CacheManagerEventListener cacheManagerEventListener)
cacheManagerEventListener - the listener to add. Can be null, in which case nothing happenspublic final boolean unregisterListener(CacheManagerEventListener cacheManagerEventListener)
cacheManagerEventListener - the listener to removepublic boolean hasRegisteredListeners()
public Set getRegisteredListeners()
CacheManagerEventListenerpublic void init()
init in interface CacheManagerEventListenerpublic Status getStatus()
getStatus in interface CacheManagerEventListenerpublic void dispose()
dispose in interface CacheManagerEventListenerpublic void notifyCacheAdded(String cacheName)
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_UNINITIALISED to
Status.STATUS_ALIVE. Care should be taken on processing that
notification because:
CacheManager.getEhcache(String)
will cause a deadlock.
notifyCacheAdded in interface CacheManagerEventListenercacheName - the name of the Cache the operation relates toCacheEventListenerpublic void notifyCacheRemoved(String cacheName)
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 CacheEventListener status changed will also be triggered. Any
attempt from that notification to access CacheManager will also result in a deadlock.
notifyCacheRemoved in interface CacheManagerEventListenercacheName - the name of the Cache the operation relates topublic String toString()
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.Copyright 2001-2021, Terracotta, Inc.