public class ListenerCollection<K,V> extends Object
| Constructor and Description |
|---|
ListenerCollection(Cache<K,V> tcache,
Builder<K,V> builder)
Creates a ListenerCollection that consists of all listeners from builder.getCacheEntryListenerConfigurations().
|
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)
Deregisters a cache listener.
|
void |
dispatchEvent(javax.cache.event.EventType eventType,
K key,
V value) |
void |
dispatchEvent(javax.cache.event.EventType eventType,
K key,
V value,
V oldValue) |
void |
dispatchEvents(Map<K,V> entries,
javax.cache.event.EventType eventType,
boolean forceAsync)
Notifies all listeners that a given EventType has happened for all the given entries.
|
boolean |
hasListenerFor(javax.cache.event.EventType eventType)
Checks whether this ListenerCollection includes at least one Listener for the given EventType.
|
void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)
Registers a cache listener.
|
void |
shutdown() |
int |
size()
Returns the number of listeners in this ListenerCollection.
|
public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)
listenerConfiguration - The Cache Listenerpublic void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)
listenerConfiguration - The Cache Listenerpublic void dispatchEvent(javax.cache.event.EventType eventType,
K key,
V value,
V oldValue)
public void dispatchEvents(Map<K,V> entries, javax.cache.event.EventType eventType, boolean forceAsync)
IMPORTANT PERFORMANCE NOTE: To avoid unnecessary object creation (TCacheEntryEvent and the event
Iterable), you SHOULD check with hasListenerFor(EventType) whether there is any Listener
interested in the given eventType. If not, do you can spare to create the TCacheEntryEvent events.
entries - The key-value pairs for which to send eventseventType - The event TypeforceAsync - Force async modepublic boolean hasListenerFor(javax.cache.event.EventType eventType)
eventType - The EventType to checkpublic int size()
public void shutdown()
Copyright © 2018 trivago. All rights reserved.