| java.lang.Object net.sf.ehcache.event.RegisteredEventListeners
RegisteredEventListeners | public class RegisteredEventListeners (Code) | | Registered listeners for registering and unregistering CacheEventListeners and multicasting notifications to registrants.
There is one of these per Cache.
This class also has counters to accumulate the numbers of each type of event for statistics purposes.
author: Greg Luck version: $Id: RegisteredEventListeners.java 558 2007-10-29 07:14:38Z gregluck $ |
Method Summary | |
public void | clearCounters() | final public void | dispose() Tell listeners to dispose themselves. | final public Set | getCacheEventListeners() | public long | getElementsEvictedCounter() Gets the number of events, irrespective of whether there are any registered listeners. | public long | getElementsExpiredCounter() Gets the number of events, irrespective of whether there are any registered listeners. | public long | getElementsPutCounter() Gets the number of events, irrespective of whether there are any registered listeners. | public long | getElementsRemoveAllCounter() Gets the number of events, irrespective of whether there are any registered listeners. | public long | getElementsRemovedCounter() Gets the number of events, irrespective of whether there are any registered listeners. | public long | getElementsUpdatedCounter() Gets the number of events, irrespective of whether there are any registered listeners. | final public boolean | hasCacheEventListeners() Returns whether or not at least one cache event listeners has been registered. | public void | notifyElementEvicted(Element element, boolean remoteEvent) | final public void | notifyElementExpiry(Element element, boolean remoteEvent) | final public void | notifyElementPut(Element element, boolean remoteEvent) | final public void | notifyElementRemoved(Element element, boolean remoteEvent) | final public void | notifyElementUpdated(Element element, boolean remoteEvent) | public void | notifyRemoveAll(boolean remoteEvent) | final public boolean | registerListener(CacheEventListener cacheEventListener) Adds a listener to the notification service. | final public String | toString() Returns a string representation of the object. | final public boolean | unregisterListener(CacheEventListener cacheEventListener) Removes a listener from the notification service. |
RegisteredEventListeners | public RegisteredEventListeners(Ehcache cache)(Code) | | Constructs a new notification service
Parameters: cache - |
clearCounters | public void clearCounters()(Code) | | Clears all event counters
|
dispose | final public void dispose()(Code) | | Tell listeners to dispose themselves.
Because this method is only ever called from a synchronized cache method, it does not itself need to be
synchronized.
|
getCacheEventListeners | final public Set getCacheEventListeners()(Code) | | Gets a list of the listeners registered to this class
a list of type CacheEventListener |
getElementsEvictedCounter | public long getElementsEvictedCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
getElementsExpiredCounter | public long getElementsExpiredCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
getElementsPutCounter | public long getElementsPutCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
getElementsRemoveAllCounter | public long getElementsRemoveAllCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
getElementsRemovedCounter | public long getElementsRemovedCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
getElementsUpdatedCounter | public long getElementsUpdatedCounter()(Code) | | Gets the number of events, irrespective of whether there are any registered listeners.
the number of events since cache creation or last clearing of counters |
hasCacheEventListeners | final public boolean hasCacheEventListeners()(Code) | | Returns whether or not at least one cache event listeners has been registered.
true if a one or more listeners have registered, otherwise false |
notifyElementEvicted | public void notifyElementEvicted(Element element, boolean remoteEvent)(Code) | | Notifies all registered listeners, in no guaranteed order, that an element has been
evicted from the cache
Parameters: element - the Element to perform the notification on Parameters: remoteEvent - whether the event came from a remote cache peer See Also: CacheEventListener.notifyElementEvicted |
notifyElementExpiry | final public void notifyElementExpiry(Element element, boolean remoteEvent)(Code) | | Notifies all registered listeners, in no guaranteed order, that an element has expired
Parameters: element - the Element to perform the notification on Parameters: remoteEvent - whether the event came from a remote cache peer See Also: CacheEventListener.notifyElementExpired |
notifyElementRemoved | final public void notifyElementRemoved(Element element, boolean remoteEvent) throws CacheException(Code) | | Notifies all registered listeners, in no guaranteed order, that an element was removed
Parameters: element - Parameters: remoteEvent - whether the event came from a remote cache peer See Also: CacheEventListener.notifyElementRemoved |
notifyRemoveAll | public void notifyRemoveAll(boolean remoteEvent)(Code) | | Notifies all registered listeners, in no guaranteed order, that removeAll
has been called and all elements cleared
Parameters: remoteEvent - whether the event came from a remote cache peer See Also: CacheEventListener.notifyElementEvicted |
registerListener | final public boolean registerListener(CacheEventListener cacheEventListener)(Code) | | Adds a listener to the notification service. No guarantee is made that listeners will be
notified in the order they were added.
Parameters: cacheEventListener - true if the listener is being added and was not already added |
toString | final public String toString()(Code) | | Returns a string representation of the object. In general, the
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.
a string representation of the object. |
unregisterListener | final public boolean unregisterListener(CacheEventListener cacheEventListener)(Code) | | Removes a listener from the notification service.
Parameters: cacheEventListener - true if the listener was present |
|
|