|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.cache.CacheEventAdapter
public class CacheEventAdapter
Adapter class responsible for firing cache events. Four different cache events are supported:
CacheEvent
,
CacheListener
Field Summary | |
---|---|
protected GenericEventMulticaster<CacheListener> |
multicaster
Holds any event listeners wanting to receive cache events. |
protected ListenerAdapter<CacheEvent,CacheListener> |
removedAdapter
A ListenerAdapter for elementRemoved events. |
protected ListenerAdapter<CacheEvent,CacheListener> |
unavailableAdapter
A ListenerAdapter for cacheUnavailable events. |
protected ListenerAdapter<CacheEvent,CacheListener> |
updatedAdapter
A ListenerAdapter for elementUpdated events. |
protected ListenerAdapter<CacheEvent,CacheListener> |
updateFailedAdapter
A ListenerAdapter for elementUpdateFailed events. |
Constructor Summary | |
---|---|
CacheEventAdapter()
Creates new CacheEventAdapter. |
Method Summary | |
---|---|
void |
addCacheListener(CacheListener listener)
Registers a CacheListener for a Cache . |
protected void |
fireCacheEvent(Cache source,
ListenerAdapter adapter,
java.lang.String elementName,
java.lang.Exception e)
A convenience method for firing a CacheEvent. |
protected void |
fireCacheEvent(Cache source,
ListenerAdapter adapter,
java.lang.String elementName,
long lastModified)
A convenience method for firing a CacheEvent. |
void |
fireCacheUnavailable(Cache source,
java.lang.Exception e)
Fires a cacheUnavailable event to all registered listeners. |
void |
fireElementRemoved(Cache source,
java.lang.String elementName)
Fires an elementRemoved event to all registered listeners. |
void |
fireElementUpdated(Cache source,
java.lang.String elementName,
long lastModified)
Fires an elementUpdated event to all registered listeners. |
void |
fireElementUpdateFailed(Cache source,
java.lang.String elementName,
java.lang.Exception e)
Fires an elementUpdateFailed event to all registered listeners. |
CacheListener[] |
getCacheListeners()
Retrieves all the listeners associated with this Cache . |
void |
removeCacheListener(CacheListener listener)
Unregisters a CacheListener for a Cache . |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final GenericEventMulticaster<CacheListener> multicaster
protected ListenerAdapter<CacheEvent,CacheListener> unavailableAdapter
protected ListenerAdapter<CacheEvent,CacheListener> updatedAdapter
protected ListenerAdapter<CacheEvent,CacheListener> updateFailedAdapter
protected ListenerAdapter<CacheEvent,CacheListener> removedAdapter
Constructor Detail |
---|
public CacheEventAdapter()
Method Detail |
---|
public void fireCacheUnavailable(Cache source, java.lang.Exception e)
source
- the source of the evente
- the Exception
that caused the event to be firedpublic void fireElementUpdated(Cache source, java.lang.String elementName, long lastModified)
source
- the source of the eventelementName
- the cache element that was updatedlastModified
- the last modification time of the cache elementpublic void fireElementUpdateFailed(Cache source, java.lang.String elementName, java.lang.Exception e)
source
- the source of the eventelementName
- the cache element that failed to be updatede
- the Exception
that caused the event to be firedpublic void fireElementRemoved(Cache source, java.lang.String elementName)
source
- the source of the eventelementName
- the cache element that was updatedprotected void fireCacheEvent(Cache source, ListenerAdapter adapter, java.lang.String elementName, java.lang.Exception e)
source
- the source of the eventadapter
- a ListenerAdapter
.elementName
- the name of the cache element in question, or null.e
- an Exception
to be included with the event, or null.protected void fireCacheEvent(Cache source, ListenerAdapter adapter, java.lang.String elementName, long lastModified)
source
- the source of the eventadapter
- a ListenerAdapter
.elementName
- the name of the cache element in question, or null.lastModified
- the time that the element was last modifiedpublic void addCacheListener(CacheListener listener)
CacheListener
for a Cache
.
listener
- the CacheListener
to be registered.public void removeCacheListener(CacheListener listener)
CacheListener
for a Cache
.
listener
- the CacheListener
to be unregistered.public CacheListener[] getCacheListeners()
Cache
.
public java.lang.String toString()
toString
in class java.lang.Object
String
representation of the object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |