public abstract class TestCacheWriter<K,V> extends TestCacheCallback implements CacheWriter<K,V>
CacheWriter used in testing. Its callback methods are implemented to thrown
UnsupportedOperationException unless the user overrides the "2" methods.TestCacheCallback.wasInvoked()callbackError| Constructor and Description |
|---|
TestCacheWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeCreate(EntryEvent<K,V> event)
Called before an entry is created.
|
void |
beforeCreate2(EntryEvent<K,V> event) |
void |
beforeCreate2(EntryEvent<K,V> event,
java.lang.Object arg)
Causes code that uses the old API to not compile
|
void |
beforeDestroy(EntryEvent<K,V> event)
Called before an entry is destroyed.
|
void |
beforeDestroy2(EntryEvent<K,V> event) |
void |
beforeDestroy2(EntryEvent<K,V> event,
java.lang.Object arg) |
void |
beforeRegionClear(RegionEvent<K,V> event)
Called before a region is cleared.
|
void |
beforeRegionDestroy(RegionEvent<K,V> event)
Called before a region is destroyed.
|
void |
beforeRegionDestroy2(RegionEvent<K,V> event) |
void |
beforeRegionDestroy2(RegionEvent<K,V> event,
java.lang.Object arg) |
void |
beforeUpdate(EntryEvent<K,V> event)
Called before an entry is updated.
|
void |
beforeUpdate2(EntryEvent<K,V> event) |
void |
beforeUpdate2(EntryEvent<K,V> event,
java.lang.Object arg) |
close, close2, isClosed, waitForInvocation, waitForInvocation, wasInvokedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseinit, initializepublic void beforeUpdate(EntryEvent<K,V> event) throws CacheWriterException
CacheWriterput or a
get that causes the loader to update an existing entry. The entry previously
existed in the cache where the operation was initiated, although the old value may have been
null. The entry being updated may or may not exist in the local cache where the CacheWriter is
installed.beforeUpdate in interface CacheWriter<K,V>event - an EntryEvent that provides information about the operation in progressCacheWriterException - if thrown will abort the operation in progress, and the exception
will be propagated back to caller that initiated the operationRegion.put(Object, Object),
Region.get(Object)public void beforeUpdate2(EntryEvent<K,V> event) throws CacheWriterException
CacheWriterExceptionpublic void beforeUpdate2(EntryEvent<K,V> event, java.lang.Object arg) throws CacheWriterException
CacheWriterExceptionpublic void beforeCreate(EntryEvent<K,V> event) throws CacheWriterException
CacheWritercreate, a
put, or a get. The CacheWriter can determine whether
this value comes from a get or not by evaluating the
Operation's Operation.isLoad() method. The entry
being created may already exist in the local cache where this CacheWriter is
installed, but it does not yet exist in the cache where the operation was initiated.beforeCreate in interface CacheWriter<K,V>event - an EntryEvent that provides information about the operation in progressCacheWriterException - if thrown will abort the operation in progress, and the exception
will be propagated back to caller that initiated the operationRegion.create(Object, Object),
Region.put(Object, Object),
Region.get(Object)public void beforeCreate2(EntryEvent<K,V> event) throws CacheWriterException
CacheWriterExceptionpublic void beforeCreate2(EntryEvent<K,V> event, java.lang.Object arg) throws CacheWriterException
CacheWriterExceptionpublic void beforeDestroy(EntryEvent<K,V> event) throws CacheWriterException
CacheWriterRegion.localDestroy(Object).beforeDestroy in interface CacheWriter<K,V>event - an EntryEvent that provides information about the operation in progressCacheWriterException - if thrown will abort the operation in progress, and the exception
will be propagated back to caller that initiated the operationRegion.destroy(Object)public void beforeDestroy2(EntryEvent<K,V> event) throws CacheWriterException
CacheWriterExceptionpublic void beforeDestroy2(EntryEvent<K,V> event, java.lang.Object arg) throws CacheWriterException
CacheWriterExceptionpublic void beforeRegionDestroy(RegionEvent<K,V> event) throws CacheWriterException
CacheWriterCacheWriter will not additionally be
called for each entry that is destroyed in the region as a result of a region destroy. If the
region's subregions have CacheWriters installed, then they will be called for the
cascading subregion destroys. This method is not called as a result of
Region.close(), Cache.close(boolean), or Region.localDestroyRegion(). However, the
Region.close() method is invoked regardless of whether a region is destroyed locally. A
non-local region destroy results in an invocation of CacheWriter.beforeRegionDestroy(org.apache.geode.cache.RegionEvent<K, V>) followed by
an invocation of Region.close().
WARNING: This method should not destroy or create any regions itself or a deadlock will occur.
beforeRegionDestroy in interface CacheWriter<K,V>event - a RegionEvent that provides information about the operationCacheWriterException - if thrown, will abort the operation in progress, and the exception
will be propagated back to the caller that initiated the operationRegion.destroyRegion()public void beforeRegionDestroy2(RegionEvent<K,V> event) throws CacheWriterException
CacheWriterExceptionpublic void beforeRegionDestroy2(RegionEvent<K,V> event, java.lang.Object arg) throws CacheWriterException
CacheWriterExceptionpublic void beforeRegionClear(RegionEvent<K,V> event) throws CacheWriterException
CacheWriterCacheWriter will not additionally be called
for each entry that is cleared in the region as a result of a region clear.
WARNING: This method should not clear/destroy any regions
beforeRegionClear in interface CacheWriter<K,V>event - a RegionEvent that provides information about the operationCacheWriterException - if thrown, will abort the operation in progress, and the exception
will be propagated back to the caller that initiated the operationRegion.clear()