public class CacheManagerEventListenerRegistry extends Object implements CacheManagerEventListener
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()
CacheManagerEventListener
public void init()
init
in interface CacheManagerEventListener
public Status getStatus()
getStatus
in interface CacheManagerEventListener
public void dispose()
dispose
in interface CacheManagerEventListener
public void notifyCacheAdded(String cacheName)
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 CacheManagerEventListener
cacheName
- the name of the Cache
the operation relates toCacheEventListener
public void notifyCacheRemoved(String cacheName)
CacheEventListener
status changed will also be triggered. Any
attempt from that notification to access CacheManager will also result in a deadlock.notifyCacheRemoved
in interface CacheManagerEventListener
cacheName
- 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 © 2003-2013 Terracotta, Inc.. All Rights Reserved.