javax.cache.event
Interface CacheEntryListener<K,V>

Type Parameters:
K - the type of keys maintained by the associated cache
V - the type of values maintained by the associated cache
All Superinterfaces:
EventListener
All Known Subinterfaces:
CacheEntryCreatedListener<K,V>, CacheEntryExpiredListener<K,V>, CacheEntryReadListener<K,V>, CacheEntryRemovedListener<K,V>, CacheEntryUpdatedListener<K,V>

public interface CacheEntryListener<K,V>
extends EventListener

Tagging interface for cache entry listeners.

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

The motivation for this design is to allow efficient implementation of network based listeners.

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

A listener is a user supplied object instance and therefore can only be registered programmatically.

The listeners are fired:

A synchronous listener is not permitted to mutate the cache it is listening on.

A listener on a transactional cache is executed orthogonally to the transaction. If synchronous it is executed after the mutation and not after the transaction commits, and if asynchronous the timing is undefined. A listener which throws an exception will not affect the transaction. A transaction which is rolled back will not unfire a listener.

A listener will be notified of events for the time it is registered. Listeners are not required to be durable.

Since:
1.0
Author:
Yannis Cosmadopoulos, Greg Luck
See Also:
CacheEntryCreatedListener, CacheEntryUpdatedListener, CacheEntryReadListener, CacheEntryRemovedListener, CacheEntryExpiredListener



Copyright © 2013. All Rights Reserved.