Class ExtensibleConfigurableCacheFactory.Manager
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.net.AbstractBackingMapManager
-
- com.tangosol.net.ExtensibleConfigurableCacheFactory.Manager
-
- All Implemented Interfaces:
BackingMapManager
- Direct Known Subclasses:
TopicBackingMapManager
- Enclosing class:
- ExtensibleConfigurableCacheFactory
public static class ExtensibleConfigurableCacheFactory.Manager extends AbstractBackingMapManager
The Manager class uses builders to create the required backing maps and provides client access to those maps.This class also implements methods to create/release backup maps as needed by PartitionedCache.Storage$BackingManager.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description Manager(ExtensibleConfigurableCacheFactory factory)
Construct the backing map manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CachingScheme
findCachingScheme(String sName)
Return theCachingScheme
for a given cache name.protected DistributedScheme
findDistributedScheme(String sName)
Return theDistributedScheme
for a given cache name.Map
getBackingMap(String sName)
Get the backing Map associated with a given cache.ExtensibleConfigurableCacheFactory
getCacheFactory()
Obtain the "container" ConfigurableCacheFactory that created this manager and which this manager is bound to.BiFunction<Ownership,PartitionedService,Member>
getReadLocator(String sName)
protected ParameterResolver
getResolver(String sName)
Return theParameterResolver
for the given cache.protected ScopedParameterResolver
getScopedResolver(String sName)
Return theScopedParameterResolver
for the given cache.StorageAccessAuthorizer
getStorageAccessAuthorizer(String sName)
Determine theStorageAccessAuthorizer
that is used by a CacheService to secure access to the NamedCache with the specified name.void
init(BackingMapManagerContext context)
Called by a CacheService to indicate to this manager that the manager is being associated with the CacheService.Map
instantiateBackingMap(String sName)
Instantiate a [thread safe] Map that should be used by a CacheService to store cached values for a NamedCache with the specified name.Map
instantiateBackupMap(String sName)
Instantiate a [thread safe] Map that should be used by a CacheService to store cached values for a NamedCache with the specified name.protected Map
instantiatePartitionedBackingMap(MapBuilder bldrMap, ParameterResolver resolver, MapBuilder.Dependencies dependencies, CachingScheme scheme)
Instantiate a partitioned backing map (an instance ofObservableSplittingBackingMap
) usingExtensibleConfigurableCacheFactory.PartitionedBackingMapManager
.boolean
isBackingMapPersistent(String sName)
Determine if the contents of the Map that is used by a CacheService to store cached values for a NamedCache with the specified name should be persisted.boolean
isBackingMapSlidingExpiry(String sName)
Determine if the Map that is used by a CacheService to store cached values for a NamedCache with specified name enables the sliding expiry - the expiry delay being extended by the read operations.boolean
isBackupPartitioned(String sName)
Return true if the backup map should be partitioned.void
releaseBackingMap(String sName, Map map)
Release the specified Map that was created using theBackingMapManager.instantiateBackingMap(String)
method.void
releaseBackupMap(String sName, Map map, Map mapListeners)
Release the specified Map that was created using theinstantiateBackupMap(String)
method.protected void
setBackingMap(String sName, Map map)
Associate the specified backing Map with a given name.-
Methods inherited from class com.tangosol.net.AbstractBackingMapManager
getContext
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.net.BackingMapManager
isBackingMapPersistent
-
-
-
-
Constructor Detail
-
Manager
public Manager(ExtensibleConfigurableCacheFactory factory)
Construct the backing map manager.- Parameters:
factory
- the factory associated with this manager
-
-
Method Detail
-
init
public void init(BackingMapManagerContext context)
Called by a CacheService to indicate to this manager that the manager is being associated with the CacheService. This method is called once immediately upon the startup of the CacheService, before any NamedCache objects are created by the CacheService.Important note: BackingMapManager cannot be associated with more then one instance of a CacheService. However, in a situation when a CacheService automatically restarts, it is possible that this manager instance is re-used by a newly created (restarted) CacheService calling this method once again providing a new context.
Important note: BackingMapManager cannot be associated with more than one instance of a CacheService. However, in a situation when a CacheService automatically restarts, it is possible that this manager instance is re-used by a newly created (restarted) CacheService calling this method once again providing a new context.
- Specified by:
init
in interfaceBackingMapManager
- Overrides:
init
in classAbstractBackingMapManager
- Parameters:
context
- the BackingMapManagerContext object for this BackingMapManager
-
instantiateBackingMap
public Map instantiateBackingMap(String sName)
Instantiate a [thread safe] Map that should be used by a CacheService to store cached values for a NamedCache with the specified name.If the contents of the Map can be modified by anything other than the CacheService itself (e.g. if the Map automatically expires its entries periodically or size-limits its contents), then the returned object must implement the ObservableMap interface.
- Parameters:
sName
- the name of the NamedCache for which this backing map is being created- Returns:
- an object implementing the Map interface that will provide backing storage for the specified cache name
-
instantiatePartitionedBackingMap
protected Map instantiatePartitionedBackingMap(MapBuilder bldrMap, ParameterResolver resolver, MapBuilder.Dependencies dependencies, CachingScheme scheme)
Instantiate a partitioned backing map (an instance ofObservableSplittingBackingMap
) usingExtensibleConfigurableCacheFactory.PartitionedBackingMapManager
. If the provided scheme is an instance ofReadWriteBackingMapScheme
, the internal scheme's map builder is used to build the backing map.- Parameters:
bldrMap
- theMapBuilder
for partitionsresolver
- theParameterizedBuilder
dependencies
- theExtensibleConfigurableCacheFactory.Dependencies
forMapBuilder
sscheme
- theCachingScheme
of the requested cache- Returns:
- partitioned backing map that will provide backing storage for the specified cache
-
isBackingMapPersistent
public boolean isBackingMapPersistent(String sName)
Determine if the contents of the Map that is used by a CacheService to store cached values for a NamedCache with the specified name should be persisted.- Parameters:
sName
- the name of the NamedCache- Returns:
- true if the CacheService should persist the backing storage of the specified NamedCache
-
isBackingMapSlidingExpiry
public boolean isBackingMapSlidingExpiry(String sName)
Determine if the Map that is used by a CacheService to store cached values for a NamedCache with specified name enables the sliding expiry - the expiry delay being extended by the read operations.- Parameters:
sName
- the name of the NamedCache- Returns:
- true if the backing map of the specified NamedCache enables the sliding expiry
-
getStorageAccessAuthorizer
public StorageAccessAuthorizer getStorageAccessAuthorizer(String sName)
Determine theStorageAccessAuthorizer
that is used by a CacheService to secure access to the NamedCache with the specified name.- Parameters:
sName
- the name of the NamedCache- Returns:
- the
StorageAccessAuthorizer
or null if the authorizer is not configured
-
getReadLocator
public BiFunction<Ownership,PartitionedService,Member> getReadLocator(String sName)
Description copied from interface:BackingMapManager
Return afunction
that when called will return amember
given the current partition owners and service, or null if the service should target the primary. This function is called by the respective service to target read requests at the relevant member, and can be specific to a cache.An implementation can return any member in the ownership chain, inferring a tolerance to stale reads when a backup (non-primary) is targeted. This may be possible as the primary (or other backups) process future changes while the member that performed the read (and was chosen by the returned function) has not.
There are several benefits in targeting backups for reads including balancing load and latency. For example, the latter can be achieved by targeting the read to a backup that resides on the same machine, rack or site. The default implementation allows this to be chosen via configuration.
- Parameters:
sName
- the name of the NamedCache- Returns:
- a function that when called will return a
member
given the current partition owners and service, or null if the service should target the primary
-
releaseBackingMap
public void releaseBackingMap(String sName, Map map)
Release the specified Map that was created using theBackingMapManager.instantiateBackingMap(String)
method. This method is invoked by the CacheService when the CacheService no longer requires the specified Map object.- Specified by:
releaseBackingMap
in interfaceBackingMapManager
- Overrides:
releaseBackingMap
in classAbstractBackingMapManager
- Parameters:
sName
- the name of the NamedCache for which the specified Map object has acted as the backing mapmap
- the Map object that is being released
-
instantiateBackupMap
public Map instantiateBackupMap(String sName)
Instantiate a [thread safe] Map that should be used by a CacheService to store cached values for a NamedCache with the specified name.- Parameters:
sName
- the name of the NamedCache for which this map is being created- Returns:
- an object implementing the Map interface that will provide backing storage for the specified cache name
-
releaseBackupMap
public void releaseBackupMap(String sName, Map map, Map mapListeners)
Release the specified Map that was created using theinstantiateBackupMap(String)
method. This method is invoked by the CacheService when the CacheService no longer requires the specified Map object.- Parameters:
sName
- the cache namemap
- the Map object that is being releasedmapListeners
- the map of listeners for the map
-
isBackupPartitioned
public boolean isBackupPartitioned(String sName)
Return true if the backup map should be partitioned.- Parameters:
sName
- the cache name- Returns:
- true if the backup map should be partitioned
-
getCacheFactory
public ExtensibleConfigurableCacheFactory getCacheFactory()
Obtain the "container" ConfigurableCacheFactory that created this manager and which this manager is bound to.- Returns:
- the ConfigurableCacheFactory that created this manager
-
getResolver
protected ParameterResolver getResolver(String sName)
Return theParameterResolver
for the given cache.- Parameters:
sName
- the cache name- Returns:
- the
ParameterResolver
-
getScopedResolver
protected ScopedParameterResolver getScopedResolver(String sName)
Return theScopedParameterResolver
for the given cache. A scoped resolver is needed so that a sub-class (like TransactionScheme.Manager) can add a parameter to the resolver.- Parameters:
sName
- the cache name- Returns:
- the
ScopedParameterResolver
-
getBackingMap
public Map getBackingMap(String sName)
Get the backing Map associated with a given cache.- Parameters:
sName
- the cache name- Returns:
- a Map associated with the specified name
-
setBackingMap
protected void setBackingMap(String sName, Map map)
Associate the specified backing Map with a given name.- Parameters:
sName
- the cache namemap
- the backing map associated with the specified name
-
findDistributedScheme
protected DistributedScheme findDistributedScheme(String sName)
Return theDistributedScheme
for a given cache name.- Parameters:
sName
- the cache name- Returns:
- the
DistributedScheme
or null
-
findCachingScheme
protected CachingScheme findCachingScheme(String sName)
Return theCachingScheme
for a given cache name. If the caching scheme is a near cache then return the back scheme.- Parameters:
sName
- the cache name- Returns:
- the
CachingScheme
or null
-
-