public abstract class CacheListenerAdapter<K,V> extends Object implements CacheListener<K,V>
Utility class that implements all methods in CacheListener
with empty
implementations. Applications can subclass this class and only override the methods for the
events of interest.
Subclasses declared in a Cache XML file, it must also implement Declarable
Constructor and Description |
---|
CacheListenerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterCreate(EntryEvent<K,V> event)
Handles the event of new key being added to a region.
|
void |
afterDestroy(EntryEvent<K,V> event)
Handles the event of an entry being destroyed.
|
void |
afterInvalidate(EntryEvent<K,V> event)
Handles the event of an entry's value being invalidated.
|
void |
afterRegionClear(RegionEvent<K,V> event)
Handles the event of a region being cleared.
|
void |
afterRegionCreate(RegionEvent<K,V> event)
Handles the event of a region being created.
|
void |
afterRegionDestroy(RegionEvent<K,V> event)
Handles the event of a region being destroyed.
|
void |
afterRegionInvalidate(RegionEvent<K,V> event)
Handles the event of a region being invalidated.
|
void |
afterRegionLive(RegionEvent<K,V> event)
Handles the event of a region being live after receiving the marker from the server.
|
void |
afterUpdate(EntryEvent<K,V> event)
Handles the event of an entry's value being modified in a region.
|
void |
close()
Called when the region containing this callback is closed or destroyed, when the cache is
closed, or when a callback is removed from a region using an
AttributesMutator . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
init, initialize
public void afterCreate(EntryEvent<K,V> event)
CacheListener
afterCreate
in interface CacheListener<K,V>
event
- the EntryEventRegion.create(Object, Object)
,
Region.put(Object, Object)
,
Region.get(Object)
public void afterDestroy(EntryEvent<K,V> event)
CacheListener
afterDestroy
in interface CacheListener<K,V>
event
- the EntryEventRegion.destroy(Object)
public void afterInvalidate(EntryEvent<K,V> event)
CacheListener
afterInvalidate
in interface CacheListener<K,V>
event
- the EntryEventRegion.invalidate(Object)
public void afterRegionDestroy(RegionEvent<K,V> event)
CacheListener
afterRegionDestroyed
event invoked on its listener.afterRegionDestroy
in interface CacheListener<K,V>
event
- the RegionEventRegion.destroyRegion()
,
Region.localDestroyRegion()
,
Region.close()
,
RegionService.close()
public void afterRegionCreate(RegionEvent<K,V> event)
CacheListener
Note that this method is only called for creates done in the local vm. To be notified of
creates done in remote vms use RegionMembershipListener.afterRemoteRegionCreate(org.apache.geode.cache.RegionEvent<K, V>)
.
afterRegionCreate
in interface CacheListener<K,V>
event
- the RegionEventCache.createRegion(java.lang.String, org.apache.geode.cache.RegionAttributes<K, V>)
,
Region.createSubregion(java.lang.String, org.apache.geode.cache.RegionAttributes<SK, SV>)
public void afterRegionInvalidate(RegionEvent<K,V> event)
CacheListener
regionInvalidated
event invoked on its listener.afterRegionInvalidate
in interface CacheListener<K,V>
event
- the RegionEventRegion.invalidateRegion()
,
Region.localInvalidateRegion()
public void afterUpdate(EntryEvent<K,V> event)
CacheListener
afterUpdate
in interface CacheListener<K,V>
event
- the EntryEventRegion.put(Object, Object)
public void afterRegionClear(RegionEvent<K,V> event)
CacheListener
afterRegionClear
in interface CacheListener<K,V>
event
- the RegionEventRegion.clear()
public void afterRegionLive(RegionEvent<K,V> event)
CacheListener
afterRegionLive
in interface CacheListener<K,V>
event
- the RegionEventCache.readyForEvents()
public void close()
CacheCallback
AttributesMutator
.
Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.
It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.
close
in interface CacheCallback
RegionService.close()
,
Region.close()
,
Region.localDestroyRegion()
,
Region.destroyRegion()
,
AttributesMutator