Class EventHandlingImpl<K,V>
- java.lang.Object
-
- org.cache2k.jcache.provider.event.EventHandlingImpl<K,V>
-
- Type Parameters:
K- key typeV- value type
- All Implemented Interfaces:
EventListener,org.cache2k.event.CacheClosedListener,org.cache2k.event.CacheLifecycleListener,EventHandling<K,V>
public class EventHandlingImpl<K,V> extends Object implements EventHandling<K,V>, org.cache2k.event.CacheClosedListener
cache2k does not support changing the listener configuration at runtime. Registers one listener for each event type to cache2k and delivers them to the JCache listeners. Synchronous events are delivered sequentially. Asynchronous events are delivered by an executor and get maximum parallelism.- Author:
- Jens Wilke
- See Also:
AsyncDispatcher
-
-
Field Summary
-
Fields inherited from interface org.cache2k.jcache.provider.event.EventHandling
DISABLED
-
-
Constructor Summary
Constructors Constructor Description EventHandlingImpl(JCacheManagerAdapter m, Executor ex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInternalListenersToCache2kConfiguration(org.cache2k.config.Cache2kConfig<K,V> cfg)booleanderegisterListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cfg)Collection<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>getAllListenerConfigurations()@Nullable CompletableFuture<Void>onCacheClosed(org.cache2k.Cache cache)Copy to a set first, because some listener instances may implement multiple interfaces and show up in the all listeners list more then oncevoidregisterListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cfg)
-
-
-
Constructor Detail
-
EventHandlingImpl
public EventHandlingImpl(JCacheManagerAdapter m, Executor ex)
-
-
Method Detail
-
deregisterListener
public boolean deregisterListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cfg)
- Specified by:
deregisterListenerin interfaceEventHandling<K,V>
-
getAllListenerConfigurations
public Collection<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getAllListenerConfigurations()
- Specified by:
getAllListenerConfigurationsin interfaceEventHandling<K,V>
-
onCacheClosed
@Nullable public @Nullable CompletableFuture<Void> onCacheClosed(org.cache2k.Cache cache)
Copy to a set first, because some listener instances may implement multiple interfaces and show up in the all listeners list more then once- Specified by:
onCacheClosedin interfaceorg.cache2k.event.CacheClosedListener- Parameters:
cache- The cache that is closing. No cache operations on entries are allowed.- Returns:
-
registerListener
public void registerListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cfg)
- Specified by:
registerListenerin interfaceEventHandling<K,V>
-
addInternalListenersToCache2kConfiguration
public void addInternalListenersToCache2kConfiguration(org.cache2k.config.Cache2kConfig<K,V> cfg)
- Specified by:
addInternalListenersToCache2kConfigurationin interfaceEventHandling<K,V>
-
-