Listeners receive notifications when entries in a region change or changes occur to the region attributes themselves. The methods on a CacheListener are invoked asynchronously. Listeners are change notifications that are invoked AFTER the change has occured. Multiple events can cause concurrent invocation of CacheListener methods. If event A occurs before event B, there is no guarantee that their corresponding CacheListener method invocations will occur in the same order. Any exceptions thrown by the listener are caught by GemFire and logged. Listeners are user callbacks that are invoked by Gemfire. It is important to ensure that minimal work is done in the listener before returning control back to Gemfire. 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
Public Member Functions | |
| virtual void | afterCreate (const EntryEvent &event) |
| Handles the event of a new key being added to a region. | |
| virtual void | afterDestroy (const EntryEvent &event) |
| Handles the event of an entry being destroyed. | |
| virtual void | afterInvalidate (const EntryEvent &event) |
| Handles the event of an entry's value being invalidated. | |
| virtual void | afterRegionDestroy (const RegionEvent &event) |
| Handles the event of a region being destroyed. | |
| virtual void | afterRegionInvalidate (const RegionEvent &event) |
| Handles the event of a region being invalidated. | |
| virtual void | afterUpdate (const EntryEvent &event) |
| Handles the event of an entry's value being modified in a region. | |
| virtual void | close (const RegionPtr ®ion) |
| Called when the region containing this callback is destroyed, when the cache is closed. | |
| void | preserveSB () const |
| Atomically increment reference count. | |
| int32_t | refCount () |
| |
| void | releaseSB () const |
| Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. | |
| virtual | ~CacheListener () |
Protected Member Functions | |
| CacheListener () | |
| virtual gemfire::CacheListener::~CacheListener | ( | ) | [virtual] |
public methods destructor
| gemfire::CacheListener::CacheListener | ( | ) | [protected] |
constructors
| virtual void gemfire::CacheListener::afterCreate | ( | const EntryEvent & | event | ) | [virtual] |
Handles the event of a 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).
| event | denotes the event object associated with the entry creation This function does not throw any exception. |
| virtual void gemfire::CacheListener::afterDestroy | ( | const EntryEvent & | event | ) | [virtual] |
Handles the event of an entry being destroyed.
| event | EntryEvent denotes the event object associated with the entry destruction |
| virtual void gemfire::CacheListener::afterInvalidate | ( | const EntryEvent & | event | ) | [virtual] |
Handles the event of an entry's value being invalidated.
| event | EntryEvent denotes the event object associated with the entry invalidation |
| virtual void gemfire::CacheListener::afterRegionDestroy | ( | const RegionEvent & | event | ) | [virtual] |
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.
| event | RegionEvent denotes the event object associated with the region destruction |
| virtual void gemfire::CacheListener::afterRegionInvalidate | ( | const RegionEvent & | event | ) | [virtual] |
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.
| event | RegionEvent denotes the event object associated with the region invalidation |
| virtual void gemfire::CacheListener::afterUpdate | ( | const EntryEvent & | event | ) | [virtual] |
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.
| event | EntryEvent denotes the event object associated with updating the entry |
| virtual void gemfire::CacheListener::close | ( | const RegionPtr & | region | ) | [virtual] |
Called when the region containing this callback is destroyed, when the cache is closed.
Implementations should clean up 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.
| void gemfire::SharedBase::preserveSB | ( | ) | const [inherited] |
Atomically increment reference count.
| int32_t gemfire::SharedBase::refCount | ( | ) | [inline, inherited] |
| void gemfire::SharedBase::releaseSB | ( | ) | const [inherited] |
Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.