public final class ReadOptions
extends java.lang.Object
implements java.io.Serializable
ReadLockingMode
,
GeoServerReadMode
,
Serialized FormModifier and Type | Method and Description |
---|---|
java.lang.Object |
getCreateArgument()
Gets an argument that will be passed to the provided
CreateHandler if a
read-through operation is required. |
CreateHandler |
getCreateHandler()
Gets the custom read-through callback to use when an attempt is made to retrieve an object that is not in the
cache.
|
CreatePolicy |
getCreatePolicy()
Gets a cache policy object to be used when a read-though operation inserts an object
into the named cache.
|
GeoServerReadMode |
getGeoServerReadMode()
Gets the remote store's read mode.
|
ReadLockingMode |
getLockingMode()
Gets the locking mode (
ReadLockingMode ). |
ReadMode |
getReadMode()
Returns the reading mode.
|
void |
setCreateHandler(CreateHandler createHandler)
Sets custom read-through callback to use when an attempt is made to retrieve an object
that is not in the cache.
|
void |
setGeoServerReadMode(GeoServerReadMode geoServerReadMode)
Sets GeoServer "pull" replication behavior when retrieving the object from the StateServer.
|
void |
setLockingMode(ReadLockingMode lockingMode)
Sets whether the Retrieve method should attempt to acquire a StateServer lock when reading the object.
|
void |
setReadMode(ReadMode mode)
Sets the read mode for this ReadOptions.
|
void |
setReadThroughArgument(java.lang.Object readThroughArgument)
Sets an argument that will be passed to the provided
CreateHandler if a
missing object is to be created. |
void |
setReadThroughCreatePolicy(CreatePolicy readThroughCreatePolicy)
Sets a cache policy object to be used when a
NamedCache.retrieve(CachedObjectId, ReadOptions)
operation is configured to transparently insert a missing object into the named cache
using CreateHandler . |
public ReadOptions(ReadLockingMode lockingMode)
NamedCache.retrieve(com.scaleoutsoftware.soss.client.CachedObjectId<T>, boolean)
and NamedCache.getMetadata(com.scaleoutsoftware.soss.client.CachedObjectId, com.scaleoutsoftware.soss.client.ReadOptions)
calls.lockingMode
- locking modepublic ReadOptions(ReadLockingMode lockingMode, GeoServerReadMode geoServerReadMode)
NamedCache.retrieve(com.scaleoutsoftware.soss.client.CachedObjectId<T>, boolean)
and NamedCache.getMetadata(com.scaleoutsoftware.soss.client.CachedObjectId, com.scaleoutsoftware.soss.client.ReadOptions)
calls.lockingMode
- determines whether the Retrieve method should attempt to acquire a StateServer lock
when reading the object.geoServerReadMode
- determines GeoServer "pull" replication behavior when retrieving the object from
the StateServer.public ReadOptions(ReadLockingMode lockingMode, GeoServerReadMode geoServerReadMode, CreateHandler createHandler, java.lang.Object createArgument, CreatePolicy createPolicy)
NamedCache.retrieve(com.scaleoutsoftware.soss.client.CachedObjectId<T>, boolean)
and NamedCache.getMetadata(com.scaleoutsoftware.soss.client.CachedObjectId, com.scaleoutsoftware.soss.client.ReadOptions)
calls.lockingMode
- determines whether the Retrieve method should attempt to acquire a StateServer lock
when reading the object.geoServerReadMode
- determines GeoServer "pull" replication behavior when retrieving the object from
the StateServer.createHandler
- custom read-through callback to use when an attempt is made to retrieve an object
that is not in the cache. If this callback is non-null then
it will override any existing read-though backing store behavior that has been
specified at the named cache level through the
NamedCache.setBackingStoreAdapter(BackingStore, BackingStorePolicy)
method.createArgument
- an argument that will be passed to the provided CreateHandler
if a
missing object is to be created.createPolicy
- a cache policy object to be used when a NamedCache.retrieve(CachedObjectId, ReadOptions)
operation is configured to transparently insert a missing object into the named cache
using CreateHandler
. If null
, the read-through will fall back to
using the policy specified at the named cache level through the
NamedCache.setBackingStoreAdapter(BackingStore, BackingStorePolicy)
(as implemented in an BackingStore.getCreatePolicy(CachedObjectId)
implementation).
If no BackingStore implementation is associated with the NamedCache
(or if BackingStore.getCreatePolicy(CachedObjectId)
returns null), the read-through
will then fall back to using the policy specified in the named cache's
NamedCache.setDefaultCreatePolicy(CreatePolicy)
property.public void setReadMode(ReadMode mode)
mode
- the ReadMode to use.public ReadMode getReadMode()
public ReadLockingMode getLockingMode()
ReadLockingMode
).public GeoServerReadMode getGeoServerReadMode()
public CreateHandler getCreateHandler()
public java.lang.Object getCreateArgument()
CreateHandler
if a
read-through operation is required.public CreatePolicy getCreatePolicy()
public void setLockingMode(ReadLockingMode lockingMode)
ReadLockingMode.NoLockOnRead
.lockingMode
- new locking modepublic void setGeoServerReadMode(GeoServerReadMode geoServerReadMode)
GeoServerReadMode.None
.geoServerReadMode
- the GeoServerReadMode
public void setCreateHandler(CreateHandler createHandler)
NamedCache.setBackingStoreAdapter(BackingStore, BackingStorePolicy)
method.
Default is null
.createHandler
- create handler implementationpublic void setReadThroughArgument(java.lang.Object readThroughArgument)
CreateHandler
if a
missing object is to be created.readThroughArgument
- an argument for create handlerpublic void setReadThroughCreatePolicy(CreatePolicy readThroughCreatePolicy)
NamedCache.retrieve(CachedObjectId, ReadOptions)
operation is configured to transparently insert a missing object into the named cache
using CreateHandler
. If null
, the read-through will fall back to
using the policy specified at the named cache level through the
NamedCache.setBackingStoreAdapter(BackingStore, BackingStorePolicy)
(as implemented in an BackingStore.getCreatePolicy(CachedObjectId)
implementation).
If no BackingStore implementation is associated with the NamedCache
(or if BackingStore.getCreatePolicy(CachedObjectId)
returns null), the read-through
will then fall back to using the policy specified in the named cache's
NamedCache.setDefaultCreatePolicy(CreatePolicy)
property.readThroughCreatePolicy
- the create policy for read-trough object