Click or drag to resize
ICacheListener Interface

Note: This API is now obsolete.

An application plug-in that can be installed on a region.

Namespace: GemStone.GemFire.Cache
Assembly: Gemstone.Gemfire.Cache (in Gemstone.Gemfire.Cache.dll) Version: 9.0.6.18
Syntax
[ObsoleteAttribute("Use classes and APIs from the GemStone.GemFire.Cache.Generic namespace")]
public interface ICacheListener

The ICacheListener type exposes the following members.

Methods
  NameDescription
Public methodAfterCreate
Handles the event of a new key being added to a region.
Public methodAfterDestroy
Handles the event of an entry being destroyed.
Public methodAfterInvalidate
Handles the event of an entry's value being invalidated.
Public methodAfterRegionClear
Handles the event of a region being cleared.
Public methodAfterRegionDestroy
Handles the event of a region being destroyed.
Public methodAfterRegionDisconnected
Public methodAfterRegionInvalidate
Handles the event of a region being invalidated.
Public methodAfterRegionLive
Handles the event of a region going live.
Public methodAfterUpdate
Handles the event of an entry's value being modified in a region.
Public methodClose
Called when the region containing this callback is destroyed, when the cache is closed.
Top
Remarks
Listeners are change notifications that are invoked AFTER the change has occured for region update operations on a client. Listeners also receive notifications when entries in a region are modified. Multiple events can cause concurrent invocation of ICacheListener methods. If event A occurs before event B, there is no guarantee that their corresponding ICacheListener method invocations will occur in the same order. Any exceptions thrown by the listener are caught by GemFire and logged. If the exception is due to listener invocation on the same thread where a region operation has been performed, then a CacheListenerException is thrown back to the application. If the exception is for a notification received from server then that is logged and the notification thread moves on to receiving other notifications.

A cache listener is defined in the RegionAttributes.

There are two cases in which listeners are invoked. The first is when a region modification operation (e.g. put, create, destroy, invalidate) is performed. For this case it is important to ensure that minimal work is done in the listener before returning control back to Gemfire since the operation will block till the listener has not completed. For example, a listener implementation may choose to hand off the event to a thread pool that then processes the event on its thread rather than the listener thread. The second is when notifications are received from java server as a result of region register interest calls (Region.RegisterKeys etc), or invalidate notifications when notify-by-subscription is false on the server. In this case the methods of ICacheListener are invoked asynchronously (i.e. does not block the thread that receives notification messages). Additionally for the latter case of notifications from server, listener is always invoked whether or not local operation is successful e.g. if a destroy notification is received and key does not exist in the region, the listener will still be invoked. This is different from the first case where listeners are invoked only when the region update operation succeeds.
See Also