public class ReadWriteBackingMapScheme extends AbstractLocalCachingScheme<ReadWriteBackingMap>
RemoteCacheScheme
is responsible for creating a fully
configured ReadWriteBackingMap. The setters are annotated so that CODI
can automatically configure the builder After the builder is configured,
the realize method can be called to create either a custom ReadWriteBackingMap
or the internal Coherence ReadWriteBackingMap.MapBuilder.Dependencies
m_serviceDependencies
DELIM_APPLICATION_SCOPE, DELIM_DOMAIN_PARTITION
Constructor and Description |
---|
ReadWriteBackingMapScheme() |
Modifier and Type | Method and Description |
---|---|
void |
establishMapListeners(Map map,
com.tangosol.config.expression.ParameterResolver resolver,
MapBuilder.Dependencies dependencies)
Establishes an appropriate
MapListener (provided by the
ObservableCachingScheme.getListenerBuilder() ) on the ObservableMap
that was produced by the ObservableCachingScheme . |
CacheStoreScheme |
getCacheStoreScheme()
Return the
CacheStoreScheme used to create a CacheStore
or CacheLoader. |
Millis |
getCacheStoreTimeout(com.tangosol.config.expression.ParameterResolver resolver)
Return the timeout interval to use for CacheStore read and write
operations.
|
ObservableMap |
getInternalMap()
Return the internal map which is set by the backing map manager when
the partitioned flag is true.
|
CachingScheme |
getInternalScheme()
Return the scheme which the specifies the map used to cache entries.
|
LocalScheme |
getMissCacheScheme()
Return the
Scheme for the cache used to maintain information on cache
misses. |
double |
getRefreshAheadFactor(com.tangosol.config.expression.ParameterResolver resolver)
Return refresh-ahead-factor used to calculate the "soft-expiration"
time for cache entries.
|
double |
getWriteBatchFactor(com.tangosol.config.expression.ParameterResolver resolver)
Return the write-batch-factor element is used to calculate the "soft-ripe"
time for write-behind queue entries.
|
Seconds |
getWriteDelay(com.tangosol.config.expression.ParameterResolver resolver)
Return the time interval to defer asynchronous writes to the cache store
for a write-behind queue.
|
int |
getWriteDelaySeconds(com.tangosol.config.expression.ParameterResolver resolver)
Return the write behind delay in seconds.
|
int |
getWriteMaxBatchSize(com.tangosol.config.expression.ParameterResolver resolver)
Return the maximum number of entries to write in a single storeAll
operation.
|
int |
getWriteRequeueThreshold(com.tangosol.config.expression.ParameterResolver resolver)
Return the size of the write-behind queue at which additional actions
could be taken.
|
protected ReadWriteBackingMap |
instantiateReadWriteBackingMap(BackingMapManagerContext context,
ObservableMap mapInternal,
Map mapMisses,
BinaryEntryStore storeBinary,
boolean fReadOnly,
int cWriteBehindSeconds,
double dflRefreshAheadFactor)
Construct a ReadWriteBackingMap using the specified parameters.
|
protected ReadWriteBackingMap |
instantiateReadWriteBackingMap(BackingMapManagerContext context,
ObservableMap mapInternal,
Map mapMisses,
CacheLoader store,
boolean fReadOnly,
int cWriteBehindSeconds,
double dflRefreshAheadFactor)
Construct a ReadWriteBackingMap using the specified parameters.
|
protected ReadWriteSplittingBackingMap |
instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context,
PartitionAwareBackingMap mapInternal,
Map mapMisses,
BinaryEntryStore storeBinary,
boolean fReadOnly,
int cWriteBehindSeconds,
double dflRefreshAheadFactor)
Construct a ReadWriteSplittingBackingMap using the specified parameters.
|
protected ReadWriteSplittingBackingMap |
instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context,
PartitionAwareBackingMap mapInternal,
Map mapMisses,
CacheLoader store,
boolean fReadOnly,
int cWriteBehindSeconds,
double dflRefreshAheadFactor)
Construct a ReadWriteSplittingBackingMap using the specified parameters.
|
boolean |
isReadOnly(com.tangosol.config.expression.ParameterResolver resolver)
Returns true if the cache is read only.
|
boolean |
isRollbackCacheStoreFailures(com.tangosol.config.expression.ParameterResolver resolver)
Return true if exceptions caught during synchronous cachestore operations
are rethrown to the calling thread (possibly over the network to a remote
member).
|
ReadWriteBackingMap |
realizeMap(com.tangosol.config.expression.ParameterResolver resolver,
MapBuilder.Dependencies dependencies)
Realize a
Map based on the state of the MapBuilder ,
resolvable parameters and provided MapBuilder.Dependencies . |
void |
setCacheStoreScheme(CacheStoreScheme bldr)
Set the
CacheStoreScheme builder. |
void |
setCacheStoreTimeout(com.tangosol.config.expression.Expression<Millis> expr)
Set the timeout interval to use for CacheStore/CacheLoader read and
write operations.
|
void |
setInternalMap(ObservableMap map)
Set the internal map.
|
void |
setInternalScheme(CachingScheme scheme)
Set the internal scheme.
|
void |
setMissCacheScheme(LocalScheme scheme)
Set the miss cache
Scheme . |
void |
setReadOnly(com.tangosol.config.expression.Expression<Boolean> expr)
Set the read-only flag.
|
void |
setRefreshAheadFactor(com.tangosol.config.expression.Expression<Double> expr)
Set the refresh ahead factor.
|
void |
setRollbackCacheStoreFailures(com.tangosol.config.expression.Expression<Boolean> expr)
Set the flag to indicate that cache store failures should be rolled back.
|
void |
setWriteBatchFactor(com.tangosol.config.expression.Expression<Double> expr)
Set the write batch factor.
|
void |
setWriteDelay(com.tangosol.config.expression.Expression<Seconds> expr)
Set the write behind delay.
|
void |
setWriteDelaySeconds(com.tangosol.config.expression.Expression<Integer> expr)
Set the write behind delay seconds.
|
void |
setWriteMaxBatchSize(com.tangosol.config.expression.Expression<Integer> expr)
Set the write max batch size.
|
void |
setWriteRequeueThreshold(com.tangosol.config.expression.Expression<Integer> expr)
Set the size of the write-behind queue at which additional actions
could be taken.
|
protected void |
validate(com.tangosol.config.expression.ParameterResolver resolver)
Validate the properties.
|
getCustomBuilder, getEventInterceptorBuilders, getServiceType, isRunningClusterNeeded, setCustomBuilder
getDefaultParameterResolver, getListenerBuilder, realizeBackingMapManager, realizeCache, setListenerBuilder
getDefaultServiceName, getScopedServiceName, getScopeName, getServiceBuilder, getServiceDependencies, getServiceName, getXml, injectScopeNameIntoService, isAutoStart, realizeService, setAutoStart, setScopeName, setServiceDependencies, setServiceName, setXml
getSchemeName, isAnonymous, setSchemeName, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getScopedServiceName, getServiceBuilder, getServiceName, isAutoStart
getSchemeName, isAnonymous
public ReadWriteBackingMap realizeMap(com.tangosol.config.expression.ParameterResolver resolver, MapBuilder.Dependencies dependencies)
Map
based on the state of the MapBuilder
,
resolvable parameters and provided MapBuilder.Dependencies
.realizeMap
in interface MapBuilder
realizeMap
in class AbstractCachingScheme
resolver
- the ParameterResolver
dependencies
- the MapBuilder.Dependencies
for realizing the Map
Map
public void establishMapListeners(Map map, com.tangosol.config.expression.ParameterResolver resolver, MapBuilder.Dependencies dependencies)
MapListener
(provided by the
ObservableCachingScheme.getListenerBuilder()
) on the ObservableMap
that was produced by the ObservableCachingScheme
.
This method will automatically inject the following types and named values into realized classes that have been annotated with @Injectable.
BackingMapManagerContext
(optionally named "manager-context")
ConfigurableCacheFactory
String
.class named "cache-name")
ClassLoader
(optionally named "class-loader")
ResourceRegistry
CacheConfig
ResourceRegistry
provided by the
ConfigurableCacheFactory
.
establishMapListeners
in interface ObservableCachingScheme
establishMapListeners
in class AbstractCachingScheme
map
- an ObservableMap
to which to add a MapListener
(if the map is not observable, no listeners are added)resolver
- the ParameterResolver
to use for resolving
builder parametersdependencies
- the MapBuilder
dependencies from which to
obtain builder informationInjectable
public CacheStoreScheme getCacheStoreScheme()
CacheStoreScheme
used to create a CacheStore
or CacheLoader.@Injectable(value="cachestore-scheme") public void setCacheStoreScheme(CacheStoreScheme bldr)
CacheStoreScheme
builder.bldr
- the builderpublic Millis getCacheStoreTimeout(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable(value="cachestore-timeout") public void setCacheStoreTimeout(com.tangosol.config.expression.Expression<Millis> expr)
expr
- the timeout interval expressionpublic CachingScheme getInternalScheme()
@Injectable(value="internal-cache-scheme") public void setInternalScheme(CachingScheme scheme)
scheme
- the internal schemepublic ObservableMap getInternalMap()
public void setInternalMap(ObservableMap map)
map
- the internal mappublic LocalScheme getMissCacheScheme()
Scheme
for the cache used to maintain information on cache
misses. The miss-cache is used track keys which were not found in the
cache store. The knowledge that a key is not in the cache store allows
some operations to perform faster, as they can avoid querying the potentially
slow cache store. A size-limited scheme may be used to control how many
misses are cached. If unspecified no cache-miss data is maintained.@Injectable(value="miss-cache-scheme") public void setMissCacheScheme(LocalScheme scheme)
Scheme
.scheme
- the miss cache schemepublic boolean isReadOnly(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setReadOnly(com.tangosol.config.expression.Expression<Boolean> expr)
expr
- true if the cache is read-onlypublic double getRefreshAheadFactor(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setRefreshAheadFactor(com.tangosol.config.expression.Expression<Double> expr)
expr
- the refresh ahead factorpublic boolean isRollbackCacheStoreFailures(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable(value="rollback-cachestore-failures") public void setRollbackCacheStoreFailures(com.tangosol.config.expression.Expression<Boolean> expr)
expr
- true if failures should be rolled backpublic double getWriteBatchFactor(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setWriteBatchFactor(com.tangosol.config.expression.Expression<Double> expr)
expr
- the write batch factorpublic Seconds getWriteDelay(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setWriteDelay(com.tangosol.config.expression.Expression<Seconds> expr)
expr
- the write behind delaypublic int getWriteDelaySeconds(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setWriteDelaySeconds(com.tangosol.config.expression.Expression<Integer> expr)
expr
- the write behind delay in secondspublic int getWriteMaxBatchSize(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setWriteMaxBatchSize(com.tangosol.config.expression.Expression<Integer> expr)
expr
- the write max batch sizepublic int getWriteRequeueThreshold(com.tangosol.config.expression.ParameterResolver resolver)
resolver
- the ParameterResolver@Injectable public void setWriteRequeueThreshold(com.tangosol.config.expression.Expression<Integer> expr)
expr
- the write re-queue thresholdprotected ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, Map mapMisses, CacheLoader store, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
This method exposes a corresponding ReadWriteBackingMap
constructor
and is provided for the express purpose of allowing its override.
context
- the context provided by the CacheService
which is using this backing mapmapInternal
- the ObservableMap used to store the data
internally in this backing mapmapMisses
- the Map used to cache CacheStore misses
(optional)store
- the object responsible for the persistence
of the cached data (optional)fReadOnly
- pass true is the specified loader is in fact
a CacheStore that needs to be used only for
read operations; changes to the cache will
not be persistedcWriteBehindSeconds
- number of seconds to write if there is a
CacheStore; zero disables write-behind
caching, which (combined with !fReadOnly)
implies write-throughdflRefreshAheadFactor
- the interval before an entry expiration time
(expressed as a percentage of the internal
cache expiration interval) during which an
asynchronous load request for the
entry will be scheduled; zero disables
refresh-ahead; only applicable when
the mapInternal parameter is an
instance of ConfigurableCacheMap
ReadWriteBackingMap
protected ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, Map mapMisses, BinaryEntryStore storeBinary, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
This method exposes a corresponding ReadWriteBackingMap
constructor
and is provided for the express purpose of allowing its override.
context
- the context provided by the CacheService
which is using this backing mapmapInternal
- the ObservableMap used to store the data
internally in this backing mapmapMisses
- the Map used to cache CacheStore misses
(optional)storeBinary
- the BinaryEntryStore responsible for the
persistence of the cached data (optional)fReadOnly
- pass true is the specified loader is in fact
a CacheStore that needs to be used only for
read operations; changes to the cache will
not be persistedcWriteBehindSeconds
- number of seconds to write if there is a
CacheStore; zero disables write-behind
caching, which (combined with !fReadOnly)
implies write-throughdflRefreshAheadFactor
- the interval before an entry expiration time
(expressed as a percentage of the internal
cache expiration interval) during which an
asynchronous load request for the
entry will be scheduled; zero disables
refresh-ahead; only applicable when
the mapInternal parameter is an
instance of ConfigurableCacheMap
ReadWriteBackingMap
protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context, PartitionAwareBackingMap mapInternal, Map mapMisses, CacheLoader store, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
This method exposes a corresponding ReadWriteSplittingBackingMap
constructor
and is provided for the express purpose of allowing its override.
context
- the context provided by the CacheService
which is using this backing mapmapInternal
- the ObservableMap used to store the data
internally in this backing mapmapMisses
- the Map used to cache CacheStore misses
(optional)store
- the object responsible for the persistence
of the cached data (optional)fReadOnly
- pass true is the specified loader is in fact
a CacheStore that needs to be used only for
read operations; changes to the cache will
not be persistedcWriteBehindSeconds
- number of seconds to write if there is a
CacheStore; zero disables write-behind
caching, which (combined with !fReadOnly)
implies write-throughdflRefreshAheadFactor
- the interval before an entry expiration time
(expressed as a percentage of the internal
cache expiration interval) during which an
asynchronous load request for the
entry will be scheduled; zero disables
refresh-ahead; only applicable when
the mapInternal parameter is an
instance of ConfigurableCacheMap
ReadWriteSplittingBackingMap
protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context, PartitionAwareBackingMap mapInternal, Map mapMisses, BinaryEntryStore storeBinary, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
This method exposes a corresponding ReadWriteSplittingBackingMap
constructor
and is provided for the express purpose of allowing its override.
context
- the context provided by the CacheService
which is using this backing mapmapInternal
- the ObservableMap used to store the data
internally in this backing mapmapMisses
- the Map used to cache CacheStore misses
(optional)storeBinary
- the BinaryEntryStore responsible for the
persistence of the cached data (optional)fReadOnly
- pass true is the specified loader is in fact
a CacheStore that needs to be used only for
read operations; changes to the cache will
not be persistedcWriteBehindSeconds
- number of seconds to write if there is a
CacheStore; zero disables write-behind
caching, which (combined with !fReadOnly)
implies write-throughdflRefreshAheadFactor
- the interval before an entry expiration time
(expressed as a percentage of the internal
cache expiration interval) during which an
asynchronous load request for the
entry will be scheduled; zero disables
refresh-ahead; only applicable when
the mapInternal parameter is an
instance of ConfigurableCacheMap
ReadWriteSplittingBackingMap
protected void validate(com.tangosol.config.expression.ParameterResolver resolver)
validate
in class AbstractCachingScheme
resolver
- the ParameterResolver needed to resolve expressions