K - the type of key.V - the type of value.public class CacheEventListenerAdaptor<K,V> extends Object implements CacheEventListener, CacheEntryListenerProvider<K,V>, NotifiableEventListener<CacheService>, ListenerWrapperEventFilter, Serializable
CacheEventListener uses the adapter pattern for wrapping all cache event listener
types into a single listener.
JCache has multiple CacheEntryListener sub-interfaces for each event type. This adapter
implementation delegates to the correct subtype using the event type.
Another responsibility of this implementation is filtering events by using the already configured event filters.
CacheEntryCreatedListener,
CacheEntryUpdatedListener,
CacheEntryRemovedListener,
CacheEntryExpiredListener,
CacheEntryEventFilter,
Serialized Form| Constructor and Description |
|---|
CacheEventListenerAdaptor(ICache<K,V> source,
javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,
SerializationService serializationService,
HazelcastInstance hazelcastInstance) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
eval(Object event) |
javax.cache.event.CacheEntryListener<K,V> |
getCacheEntryListener()
Gets wrapped
CacheEntryListener |
Object |
getListener()
Gets the wrapped listener.
|
void |
handle(int type,
Collection<CacheEventData> keys,
int completionId) |
void |
handleEvent(Object eventObject)
Cache Event handling function.
|
void |
onDeregister(CacheService cacheService,
String serviceName,
String topic,
EventRegistration registration)
Called when this listener deregistered from
EventService. |
void |
onRegister(CacheService cacheService,
String serviceName,
String topic,
EventRegistration registration)
Called when this listener registered to
EventService. |
public CacheEventListenerAdaptor(ICache<K,V> source, javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration, SerializationService serializationService, HazelcastInstance hazelcastInstance)
public javax.cache.event.CacheEntryListener<K,V> getCacheEntryListener()
CacheEntryListenerProviderCacheEntryListenergetCacheEntryListener in interface CacheEntryListenerProvider<K,V>CacheEntryListenerpublic void handleEvent(Object eventObject)
CacheEventListenerhandleEvent in interface CacheEventListenereventObject - Event data object, can be one of CacheEventSet or CacheEventData classes.Event Types that can be handled.public void handle(int type,
Collection<CacheEventData> keys,
int completionId)
public void onRegister(CacheService cacheService, String serviceName, String topic, EventRegistration registration)
NotifiableEventListenerEventService.onRegister in interface NotifiableEventListener<CacheService>cacheService - the service instance that event belongs toserviceName - name of the service that event belongs totopic - name of the topic that event belongs toregistration - the EventRegistration instance
that holds information about the registrationpublic void onDeregister(CacheService cacheService, String serviceName, String topic, EventRegistration registration)
NotifiableEventListenerEventService.onDeregister in interface NotifiableEventListener<CacheService>cacheService - the service instance that event belongs toserviceName - name of the service that event belongs totopic - name of the topic that event belongs toregistration - the EventRegistration instance
that holds information about the registrationpublic boolean eval(Object event)
eval in interface EventFilterpublic Object getListener()
ListenerWrapperEventFiltergetListener in interface ListenerWrapperEventFilterCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.