GemFire 5.8

com.gemstone.gemfire.cache.util
Class CacheListenerAdapter

java.lang.Object
  extended by com.gemstone.gemfire.cache.util.CacheListenerAdapter
All Implemented Interfaces:
CacheCallback, CacheListener
Direct Known Subclasses:
RegionMembershipListenerAdapter

public abstract class CacheListenerAdapter
extends Object
implements CacheListener

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.

Since:
3.0

Constructor Summary
CacheListenerAdapter()
           
 
Method Summary
 void afterCreate(EntryEvent event)
          Handles the event of new key being added to a region.
 void afterDestroy(EntryEvent event)
          Handles the event of an entry being destroyed.
 void afterInvalidate(EntryEvent event)
          Handles the event of an entry's value being invalidated.
 void afterRegionClear(RegionEvent event)
          Handles the event of a region being cleared.
 void afterRegionCreate(RegionEvent event)
          Handles the event of a region being created.
 void afterRegionDestroy(RegionEvent event)
          Handles the event of a region being destroyed.
 void afterRegionInvalidate(RegionEvent event)
          Handles the event of a region being invalidated.
 void afterRegionLive(RegionEvent event)
          Handles the event of a region being live after receiving the marker from the server.
 void afterUpdate(EntryEvent 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheListenerAdapter

public CacheListenerAdapter()
Method Detail

afterCreate

public void afterCreate(EntryEvent event)
Description copied from interface: CacheListener
Handles the event of new key being added to a region. The entry did not previously exist in this region in the local cache (even with a null value).

Specified by:
afterCreate in interface CacheListener
Parameters:
event - the EntryEvent
See Also:
Region.create(Object, Object), Region.put(Object, Object), Region.get(Object)

afterDestroy

public void afterDestroy(EntryEvent event)
Description copied from interface: CacheListener
Handles the event of an entry being destroyed.

Specified by:
afterDestroy in interface CacheListener
Parameters:
event - the EntryEvent
See Also:
Region.destroy(Object)

afterInvalidate

public void afterInvalidate(EntryEvent event)
Description copied from interface: CacheListener
Handles the event of an entry's value being invalidated.

Specified by:
afterInvalidate in interface CacheListener
Parameters:
event - the EntryEvent
See Also:
Region.invalidate(Object)

afterRegionDestroy

public void afterRegionDestroy(RegionEvent event)
Description copied from interface: CacheListener
Handles the event of a region being destroyed. Events are not invoked for each individual entry that is destroyed as a result of the region being destroyed. Each subregion, however, gets its own afterRegionDestroyed event invoked on its listener.

Specified by:
afterRegionDestroy in interface CacheListener
Parameters:
event - the RegionEvent
See Also:
Region.destroyRegion(), Region.localDestroyRegion(), Region.close(), Cache.close()

afterRegionCreate

public void afterRegionCreate(RegionEvent event)
Description copied from interface: CacheListener
Handles the event of a region being created. Events are invoked for each individual region that is created.

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(com.gemstone.gemfire.cache.RegionEvent).

Specified by:
afterRegionCreate in interface CacheListener
Parameters:
event - the RegionEvent
See Also:
Cache.createRegion(java.lang.String, com.gemstone.gemfire.cache.RegionAttributes), Region.createSubregion(java.lang.String, com.gemstone.gemfire.cache.RegionAttributes)

afterRegionInvalidate

public void afterRegionInvalidate(RegionEvent event)
Description copied from interface: CacheListener
Handles the event of a region being invalidated. Events are not invoked for each individual value that is invalidated as a result of the region being invalidated. Each subregion, however, gets its own regionInvalidated event invoked on its listener.

Specified by:
afterRegionInvalidate in interface CacheListener
Parameters:
event - the RegionEvent
See Also:
Region.invalidateRegion(), Region.localInvalidateRegion()

afterUpdate

public void afterUpdate(EntryEvent event)
Description copied from interface: CacheListener
Handles the event of an entry's value being modified in a region. This entry previously existed in this region in the local cache, but its previous value may have been null.

Specified by:
afterUpdate in interface CacheListener
Parameters:
event - the EntryEvent
See Also:
Region.put(Object, Object)

afterRegionClear

public void afterRegionClear(RegionEvent event)
Description copied from interface: CacheListener
Handles the event of a region being cleared. Events are not invoked for each individual entry that is removed as a result of the region being cleared.

Specified by:
afterRegionClear in interface CacheListener
Parameters:
event - the RegionEvent
See Also:
Region.clear()

afterRegionLive

public void afterRegionLive(RegionEvent event)
Description copied from interface: CacheListener
Handles the event of a region being live after receiving the marker from the server.

Specified by:
afterRegionLive in interface CacheListener
Parameters:
event - the RegionEvent
See Also:
Cache.readyForEvents()

close

public void close()
Description copied from interface: CacheCallback
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.

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.

Specified by:
close in interface CacheCallback
See Also:
Cache.close(), Region.close(), Region.localDestroyRegion(), Region.destroyRegion(), AttributesMutator

GemFire 5.8

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.