public class RegisteredEventListeners extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RegisteredEventListeners.ElementCreationCallback
Callback interface for creating elements to pass to registered listeners.
|
Constructor and Description |
---|
RegisteredEventListeners(Cache cache)
Constructs a new notification service
|
RegisteredEventListeners(Ehcache cache,
CacheStoreHelper helper)
Construct a registered event listeners service
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Tell listeners to dispose themselves.
|
Set<CacheEventListener> |
getCacheEventListeners()
Gets a copy of the set of the listeners registered to this class
|
boolean |
hasCacheEventListeners()
Returns whether or not at least one cache event listeners has been registered.
|
boolean |
hasCacheReplicators()
Determines whether any registered listeners are CacheReplicators.
|
void |
notifyElementEvicted(Element element,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element has been
evicted from the cache
|
void |
notifyElementEvicted(RegisteredEventListeners.ElementCreationCallback callback,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element has been
evicted from the cache
|
void |
notifyElementExpiry(Element element,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element has expired
|
void |
notifyElementExpiry(RegisteredEventListeners.ElementCreationCallback callback,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element has expired
|
void |
notifyElementPut(Element element,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element was put into the cache
|
void |
notifyElementPut(RegisteredEventListeners.ElementCreationCallback callback,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element was put into the cache
|
void |
notifyElementPutOrdered(Element element)
Notifies
InternalCacheEventListener s, when a put happens |
void |
notifyElementRemoved(Element element,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element was removed
|
void |
notifyElementRemoved(RegisteredEventListeners.ElementCreationCallback callback,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element was removed
|
void |
notifyElementRemovedOrdered(Element element)
Notifies
InternalCacheEventListener s, when a remove happens |
void |
notifyElementUpdated(Element element,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element in the cache was updated
|
void |
notifyElementUpdated(RegisteredEventListeners.ElementCreationCallback callback,
boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that an element in the cache was updated
|
void |
notifyElementUpdatedOrdered(Element oldElement,
Element newElement)
Notifies
InternalCacheEventListener s, when an update happens |
void |
notifyRemoveAll(boolean remoteEvent)
Notifies all registered listeners, in no guaranteed order, that removeAll
has been called and all elements cleared
|
boolean |
registerListener(CacheEventListener cacheEventListener)
Adds a listener to the notification service.
|
boolean |
registerListener(CacheEventListener cacheEventListener,
NotificationScope scope)
Adds a listener to the notification service.
|
String |
toString()
Returns a string representation of the object.
|
boolean |
unregisterListener(CacheEventListener cacheEventListener)
Removes a listener from the notification service.
|
public RegisteredEventListeners(Cache cache)
cache
- public RegisteredEventListeners(Ehcache cache, CacheStoreHelper helper)
public final void notifyElementUpdatedOrdered(Element oldElement, Element newElement)
InternalCacheEventListener
s, when an update happensoldElement
- the old elementnewElement
- the new elementpublic final void notifyElementRemovedOrdered(Element element)
InternalCacheEventListener
s, when a remove happenselement
- the element removespublic final void notifyElementPutOrdered(Element element)
InternalCacheEventListener
s, when a put happenselement
- the element putpublic final void notifyElementRemoved(Element element, boolean remoteEvent) throws CacheException
element
- remoteEvent
- whether the event came from a remote cache peerCacheException
CacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final void notifyElementRemoved(RegisteredEventListeners.ElementCreationCallback callback, boolean remoteEvent) throws CacheException
callback
- remoteEvent
- whether the event came from a remote cache peerCacheException
CacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final void notifyElementPut(Element element, boolean remoteEvent) throws CacheException
element
- remoteEvent
- whether the event came from a remote cache peerCacheException
CacheEventListener.notifyElementPut(net.sf.ehcache.Ehcache,net.sf.ehcache.Element)
public final void notifyElementPut(RegisteredEventListeners.ElementCreationCallback callback, boolean remoteEvent) throws CacheException
callback
- remoteEvent
- whether the event came from a remote cache peerCacheException
CacheEventListener.notifyElementPut(net.sf.ehcache.Ehcache,net.sf.ehcache.Element)
public final void notifyElementUpdated(Element element, boolean remoteEvent)
element
- remoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementPut(net.sf.ehcache.Ehcache,net.sf.ehcache.Element)
public final void notifyElementUpdated(RegisteredEventListeners.ElementCreationCallback callback, boolean remoteEvent)
callback
- remoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementPut(net.sf.ehcache.Ehcache,net.sf.ehcache.Element)
public final void notifyElementExpiry(Element element, boolean remoteEvent)
element
- the Element to perform the notification onremoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementExpired(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final void notifyElementExpiry(RegisteredEventListeners.ElementCreationCallback callback, boolean remoteEvent)
callback
- remoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementExpired(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final boolean hasCacheEventListeners()
public final void notifyElementEvicted(Element element, boolean remoteEvent)
element
- the Element to perform the notification onremoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final void notifyElementEvicted(RegisteredEventListeners.ElementCreationCallback callback, boolean remoteEvent)
callback
- remoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final void notifyRemoveAll(boolean remoteEvent)
remoteEvent
- whether the event came from a remote cache peerCacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public final boolean registerListener(CacheEventListener cacheEventListener)
cacheEventListener
- public final boolean registerListener(CacheEventListener cacheEventListener, NotificationScope scope)
listenForparameter.
cacheEventListener
- The listener to addscope
- The notification scopepublic final boolean unregisterListener(CacheEventListener cacheEventListener)
cacheEventListener
- public final boolean hasCacheReplicators()
public final Set<CacheEventListener> getCacheEventListeners()
CacheEventListener
public final void dispose()
public final 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–2016 Terracotta, Inc.. All rights reserved.