Package javax.cache.event
Interface CacheEntryListener<K,V>
- Type Parameters:
K
- the type of keyV
- the type of value
- All Superinterfaces:
EventListener
- All Known Subinterfaces:
CacheEntryCreatedListener<K,
,V> CacheEntryExpiredListener<K,
,V> CacheEntryRemovedListener<K,
,V> CacheEntryUpdatedListener<K,
V>
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:
- are fired after the entry is mutated in the cache
- if synchronous are fired, for a given key, in the order that events occur
- block the calling thread until the listener returns, where the listener was registered as synchronous
- that are asynchronous iterate through multiple events with an undefined ordering, except that events on the same key are in the order that the events occur.
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.
- Since:
- 1.0
- See Also: