Top Description
javax.cache.event

public Interface CacheEntryListener<K, V>

extends EventListener
Known Direct Subinterfaces
javax.cache.event.CacheEntryRemovedListener, javax.cache.event.CacheEntryUpdatedListener, javax.cache.event.CacheEntryCreatedListener, javax.cache.event.CacheEntryExpiredListener
Type Parameters
<K>
the type of key
<V>
the type of value
Imports
java.util.EventListener

A tagging interface for cache entry listeners.

Sub-interfaces exist for the various cache events allowing a listener to be created that implements only those listeners it is interested in.

Listeners should be implemented with care. In particular it is important to consider their impact on performance and latency.

Listeners:

Listeners follow the observer pattern. An exception thrown by a listener does not cause the cache operation to fail.

Listeners can only throw CacheEntryListenerException. Caching implementations must catch any other Exception from a listener, then wrap and rethrow it as a CacheEntryListenerException.

A listener that mutates a cache on the CacheManager may cause a deadlock. Detection and response to deadlocks is implementation specific.

Authors
Yannis Cosmadopoulos, Greg Luck
Since
1.0
See Also
CacheEntryCreatedListener, CacheEntryUpdatedListener, CacheEntryRemovedListener, CacheEntryExpiredListener, EventType