|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ehcache.jcache.JCacheListenerAdapter<K,V>
K - the type of keys used by this JCacheListenerAdapterV - the type of values that are loaded by this JCacheListenerAdapterpublic class JCacheListenerAdapter<K,V>
Adapt a CacheEntryListener to the CacheEventListener interface
| Constructor Summary | |
|---|---|
JCacheListenerAdapter(javax.cache.event.CacheEntryListener<K,V> cacheListener,
JCache<K,V> jCache,
javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Construct an adapter that wraps the cacheListener to be used by Ehcache
The interfaces of CacheEntryListener are more fine-grained than the
CacheEntryListener interface - and may only implement one or more of the following
sub-interfaces:
CacheEntryRemovedListener
CacheEntryCreatedListener
CacheEntryUpdatedListener
CacheEntryExpiredListener
When this constructor is called, the cacheListener will be inspected
and based upon which sub-interfaces of CacheEntryListener the cacheListener
implements, listeners on the corresponding EHCache events will be adapted to it. |
|
| Method Summary | |
|---|---|
Object |
clone()
Creates and returns a copy of this object. |
void |
dispose()
Give the listener a chance to cleanup and free resources when no longer needed |
boolean |
equals(Object o)
|
int |
hashCode()
|
void |
notifyElementEvicted(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Called immediately after an element is evicted from the cache. |
void |
notifyElementExpired(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Called immediately after an element is found to be expired. |
void |
notifyElementPut(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Called immediately after an element has been put into the cache. |
void |
notifyElementRemoved(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Called immediately after an attempt to remove an element. |
void |
notifyElementUpdated(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Called immediately after an element has been put into the cache and the element already existed in the cache. |
void |
notifyRemoveAll(net.sf.ehcache.Ehcache cache)
Called during Ehcache.removeAll() to indicate that the all
elements have been removed from the cache in a bulk operation. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JCacheListenerAdapter(javax.cache.event.CacheEntryListener<K,V> cacheListener,
JCache<K,V> jCache,
javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
cacheListener to be used by Ehcache
The interfaces of CacheEntryListener are more fine-grained than the
CacheEntryListener interface - and may only implement one or more of the following
sub-interfaces:
CacheEntryRemovedListener
CacheEntryCreatedListener
CacheEntryUpdatedListener
CacheEntryExpiredListener
When this constructor is called, the cacheListener will be inspected
and based upon which sub-interfaces of CacheEntryListener the cacheListener
implements, listeners on the corresponding EHCache events will be adapted to it.
It is expected that the EventListener model of JSR107 will change, so this class
will likely be refactored several times before the final release of JSR107.
cacheListener - the cacheListener to wrapjCache - cacheEntryListenerConfiguration - | Method Detail |
|---|
public void notifyElementRemoved(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
throws net.sf.ehcache.CacheException
notifyRemoveAll(net.sf.ehcache.Ehcache)
notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
notifyElementRemoved in interface net.sf.ehcache.event.CacheEventListenernet.sf.ehcache.CacheException
public void notifyElementPut(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
throws net.sf.ehcache.CacheException
Cache.put(net.sf.ehcache.Element) method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementPut in interface net.sf.ehcache.event.CacheEventListenernet.sf.ehcache.CacheException
public void notifyElementUpdated(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
throws net.sf.ehcache.CacheException
Cache.put(net.sf.ehcache.Element) method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementUpdated in interface net.sf.ehcache.event.CacheEventListenernet.sf.ehcache.CacheException
public void notifyElementExpired(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
Cache.remove(Object) method will block until this method returns.
As the Element has been expired, only what was the key of the element is known.
Elements are checked for expiry in ehcache at the following times:
Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS
notifyElementExpired in interface net.sf.ehcache.event.CacheEventListener
public void notifyElementEvicted(net.sf.ehcache.Ehcache cache,
net.sf.ehcache.Element element)
notifyElementEvicted in interface net.sf.ehcache.event.CacheEventListenerpublic void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
Ehcache.removeAll() to indicate that the all
elements have been removed from the cache in a bulk operation. The usual
notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
is not called.
This notification exists because clearing a cache is a special case. It is often
not practical to serially process notifications where potentially millions of elements
have been bulk deleted.
notifyRemoveAll in interface net.sf.ehcache.event.CacheEventListenerpublic void dispose()
dispose in interface net.sf.ehcache.event.CacheEventListener
public Object clone()
throws CloneNotSupportedException
x, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone. If a class and all of its superclasses (except
Object) obey this convention, it will be the case that
x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone for class Object performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable, then a
CloneNotSupportedException is thrown. Note that all arrays
are considered to implement the interface Cloneable and that
the return type of the clone method of an array type T[]
is T[] where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface
Cloneable, so calling the clone method on an object
whose class is Object will result in throwing an
exception at run time.
clone in interface net.sf.ehcache.event.CacheEventListenerclone in class ObjectCloneNotSupportedExceptionCloneablepublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||