public class LocalSessionCacheWriter extends CacheWriterAdapter<java.lang.String,javax.servlet.http.HttpSession> implements Declarable
Constructor and Description |
---|
LocalSessionCacheWriter(Region<java.lang.String,javax.servlet.http.HttpSession> backingRegion) |
Modifier and Type | Method and Description |
---|---|
void |
beforeCreate(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event)
Called before an entry is created.
|
void |
beforeDestroy(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event)
Called before an entry is destroyed.
|
void |
beforeUpdate(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event)
Called before an entry is updated.
|
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 . |
void |
init(java.util.Properties p)
Initializes a user-defined object using the given properties.
|
beforeRegionClear, beforeRegionDestroy
public LocalSessionCacheWriter(Region<java.lang.String,javax.servlet.http.HttpSession> backingRegion)
public void beforeCreate(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event) throws CacheWriterException
CacheWriter
create
, 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<java.lang.String,javax.servlet.http.HttpSession>
beforeCreate
in class CacheWriterAdapter<java.lang.String,javax.servlet.http.HttpSession>
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 beforeUpdate(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event) throws CacheWriterException
CacheWriter
put
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<java.lang.String,javax.servlet.http.HttpSession>
beforeUpdate
in class CacheWriterAdapter<java.lang.String,javax.servlet.http.HttpSession>
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 beforeDestroy(EntryEvent<java.lang.String,javax.servlet.http.HttpSession> event) throws CacheWriterException
CacheWriter
Region.localDestroy(Object)
.beforeDestroy
in interface CacheWriter<java.lang.String,javax.servlet.http.HttpSession>
beforeDestroy
in class CacheWriterAdapter<java.lang.String,javax.servlet.http.HttpSession>
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 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
close
in class CacheWriterAdapter<java.lang.String,javax.servlet.http.HttpSession>
RegionService.close()
,
Region.close()
,
Region.localDestroyRegion()
,
Region.destroyRegion()
,
AttributesMutator
public void init(java.util.Properties p)
Declarable
Cache
initialization to fail.init
in interface Declarable
p
- Contains the parameters declared in the declarative xml
file.