public class CacheEventDispatcherImpl<K,V> extends java.lang.Object implements CacheEventDispatcher<K,V>
Use of this class is linked to having cache events on a user managed cache
.
Note on event ordering guarantees: Events are received and transmitted to register listeners through the
registration of a StoreEventListener
on the linked StoreEventSource
which is responsible for event
ordering.
Constructor and Description |
---|
CacheEventDispatcherImpl(java.util.concurrent.ExecutorService unOrderedExecutor,
java.util.concurrent.ExecutorService orderedExecutor)
Creates a new
CacheEventDispatcher instance that will use the provided ExecutorService to handle
events firing. |
Modifier and Type | Method and Description |
---|---|
void |
deregisterCacheEventListener(CacheEventListener<? super K,? super V> listener)
De-registers a cache event listener from this dispatcher.
|
java.util.List<CacheConfigurationChangeListener> |
getConfigurationChangeListeners()
Returns the
List of CacheConfigurationChangeListener defined. |
void |
registerCacheEventListener(CacheEventListener<? super K,? super V> listener,
EventOrdering ordering,
EventFiring firing,
java.util.EnumSet<EventType> forEventTypes)
Registers a new cache event listener in this dispatcher.
|
void |
setListenerSource(Cache<K,V> source)
Injects the cache acting as the event source
|
void |
setStoreEventSource(StoreEventSource<K,V> eventSource)
Injects the store event source providing events to the listeners.
|
void |
shutdown()
Shuts down this dispatcher
|
public CacheEventDispatcherImpl(java.util.concurrent.ExecutorService unOrderedExecutor, java.util.concurrent.ExecutorService orderedExecutor)
CacheEventDispatcher
instance that will use the provided ExecutorService
to handle
events firing.unOrderedExecutor
- the executor service used when ordering is not requiredorderedExecutor
- the executor service used when ordering is requiredpublic void registerCacheEventListener(CacheEventListener<? super K,? super V> listener, EventOrdering ordering, EventFiring firing, java.util.EnumSet<EventType> forEventTypes)
registerCacheEventListener
in interface CacheEventDispatcher<K,V>
listener
- the listener to registerordering
- event orderingfiring
- event firingforEventTypes
- event types this listener wantspublic void deregisterCacheEventListener(CacheEventListener<? super K,? super V> listener)
deregisterCacheEventListener
in interface CacheEventDispatcher<K,V>
listener
- the listener to removepublic void shutdown()
shutdown
in interface CacheEventDispatcher<K,V>
public void setListenerSource(Cache<K,V> source)
setListenerSource
in interface CacheEventDispatcher<K,V>
source
- the cache this dispatcher works withpublic java.util.List<CacheConfigurationChangeListener> getConfigurationChangeListeners()
List
of CacheConfigurationChangeListener
defined.getConfigurationChangeListeners
in interface ConfigurationChangeSupport
CacheConfigurationChangeListener
public void setStoreEventSource(StoreEventSource<K,V> eventSource)
setStoreEventSource
in interface CacheEventDispatcher<K,V>
eventSource
- the store event source