Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.net
Class DefaultConfigurableCacheFactory

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.DefaultConfigurableCacheFactory

All Implemented Interfaces:
ConfigurableCacheFactory, XmlConfigurable

public class DefaultConfigurableCacheFactory
extends Base
implements ConfigurableCacheFactory

DefaultConfigurableCacheFactory provides a facility to access caches declared in a "cache-config.dtd" compliant configuration file.

This class is designed to be easily extendable with a collection of factory methods allowing subclasses to customize it by overriding any subset of cache instantiation routines or even allowing addition of custom schemes.

There are various ways of using this factory:

   ConfigurableCacheFactory factory =
       new DefaultConfigurableCacheFactory(sPath);
   ...
   ClassLoader loader  = getClass().getClassLoader();
   NamedCache cacheOne = factory.ensureCache("one", loader);
   NamedCache cacheTwo = factory.ensureCache("two", loader);
 

Using this approach allows an easy customization by extending the DefaultConfigurableCacheFactory and changing the instantiation line:

   ConfigurableCacheFactory factory = new CustomConfigurableCacheFactory();
   ...
 

Another option is using the static version of the "ensureCache" call:

   ClassLoader loader  = getClass().getClassLoader();
   NamedCache cacheOne = CacheFactory.getCache("one", loader);
   NamedCache cacheTwo = CacheFactory.getCache("two", loader);
 

which uses an instance of ConfigurableCacheFactory obtained by CacheFactory.getConfigurableCacheFactory().

Since:
Coherence 2.2
Author:
gg 2003.05.26
See Also:
CacheFactory.getCache(String, ClassLoader)

Nested Class Summary
static class DefaultConfigurableCacheFactory.CacheInfo
          CacheInfo is a placeholder for cache attributes retrieved during parsing the corresponding cache mapping element.
 class DefaultConfigurableCacheFactory.Manager
          BackingMapManager implementation that uses the configuration XML to create the required backing maps and provides client access to those maps.
protected  class DefaultConfigurableCacheFactory.PartitionedBackingMapManager
          BackingMapManager implementation used by PartitionAwareBackingMap(s) to lazily configure the enclosing PABM based on the configuration settings of the enclosed maps.

 

Field Summary
static java.lang.String CACHE_NAME
          The name of the replaceable parameter representing the cache name.
static java.lang.String CACHE_REF
          The name of the replaceable parameter representing a cache reference.
static java.lang.String CLASS_LOADER
          The name of the replaceable parameter representing the class loader.
static java.lang.String FILE_CFG_CACHE
          The default configuration file name.
static java.lang.String JOURNAL_SERVICE_NAME
          The name of the JournalService as a registered resource.
protected  java.util.Set m_setManager
          A Set of BackingMapManager instances registered by this factory.
protected  ScopedReferenceStore m_store
          Store that holds cache references scoped by class loader and optionally, if configured, Subject.
static java.lang.String MGR_CONTEXT
          The name of the replaceable parameter representing the backing map manager context.
static int SCHEME_CLASS
          The custom class scheme.
static int SCHEME_DISK
          Deprecated. As of Coherence 3.0, replaced by SCHEME_EXTERNAL and SCHEME_EXTERNAL_PAGED
static int SCHEME_DISTRIBUTED
          The distributed cache scheme.
static int SCHEME_EXTERNAL
          The external scheme.
static int SCHEME_EXTERNAL_PAGED
          The paged-external scheme.
static int SCHEME_FLASHJOURNAL
          The flash journal cache scheme.
static int SCHEME_INVOCATION
          The invocation service scheme.
static int SCHEME_LOCAL
          The local cache scheme.
static int SCHEME_NEAR
          The near cache scheme.
static int SCHEME_OPTIMISTIC
          The optimistic cache scheme.
static int SCHEME_OVERFLOW
          The overflow map scheme.
static int SCHEME_PROXY
          The proxy service scheme.
static int SCHEME_RAMJOURNAL
          The ram journal cache scheme.
static int SCHEME_READ_WRITE_BACKING
          The read write backing map scheme.
static java.lang.String SCHEME_REF
          The name of the replaceable parameter representing a scheme reference.
static int SCHEME_REMOTE_CACHE
          The remote cache scheme.
static int SCHEME_REMOTE_INVOCATION
          The remote invocation scheme.
static int SCHEME_REPLICATED
          The replicated cache scheme.
static int SCHEME_TRANSACTIONAL
          The transactional cache scheme.
static int SCHEME_UNKNOWN
          The unknown scheme type.
static int SCHEME_VERSIONED_BACKING
          The versioned backing map scheme.
static int SCHEME_VERSIONED_NEAR
          The versioned near cache scheme.

 

Constructor Summary
DefaultConfigurableCacheFactory()
          Construct a default DefaultConfigurableCacheFactory using the default configuration file name.
DefaultConfigurableCacheFactory(java.lang.String sPath)
          Construct a DefaultConfigurableCacheFactory using the specified path to a "cache-config.dtd" compliant configuration file or resource.
DefaultConfigurableCacheFactory(java.lang.String sPath, java.lang.ClassLoader loader)
          Construct a DefaultConfigurableCacheFactory using the specified path to a "cache-config.dtd" compliant configuration file or resource.
DefaultConfigurableCacheFactory(XmlElement xmlConfig)
          Construct a DefaultConfigurableCacheFactory using the specified configuration XML.
DefaultConfigurableCacheFactory(XmlElement xmlConfig, java.lang.ClassLoader loader)
          Construct a DefaultConfigurableCacheFactory using the specified configuration XML.

 

Method Summary
protected  java.lang.String applyScopeToServiceName(java.lang.String sServiceName)
          Apply the scope name prefix to the given service name.
protected static void checkPermission(NamedCache cache)
          Check if the current user is allowed to "join" the cache.
static java.util.Map collectServiceSchemes(XmlElement xmlConfig)
          Collect a map keyed by service names with values of corresponding service schemes in the specified cache configuration.
protected static void collectServiceSchemes(XmlElement xmlScheme, XmlElement xmlConfig, java.util.HashMap mapService)
          Collect the service-schemes referenced by the specified scheme element in the cache configuration and update the specified mapping of service names to the associated service schemes.
 java.util.Map configureBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlScheme, BackingMapManagerContext context, java.lang.ClassLoader loader, java.util.Map mapListeners)
          Configures a backing map according to the scheme.
 NamedCache configureCache(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlScheme, java.lang.ClassLoader loader)
          Ensures a cache for given scheme.
protected  void configureUnitCalculator(XmlElement xmlCache, ConfigurableCacheMap cache, DefaultConfigurableCacheFactory.CacheInfo info, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Configure a UnitCalculator for the specified ConfigurableCacheMap.
protected  double convertDouble(XmlValue xmlValue)
          Convert the value in the specified XmlValue to a double.
protected  int convertInt(XmlValue xmlValue)
          Convert the value in the specified XmlValue to an int.
protected  int convertInt(XmlValue xmlValue, int nDefault)
          Convert the value in the specified XmlValue to an int.
protected  long convertLong(XmlValue xmlValue)
          Convert the value in the specified XmlValue to a long.
 void destroyCache(NamedCache cache)
          Release and destroy this instance of NamedCache.
protected  BinaryStoreManager ensureBackupJournalRM(Cluster cluster)
          Ensure the BackupJournalRM is configured and started.
protected  NamedCache ensureCache(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlScheme, java.lang.ClassLoader loader)
          Obtain the NamedCache reference for the cache service defined by the specified scheme.
 NamedCache ensureCache(java.lang.String sCacheName, java.lang.ClassLoader loader)
          Ensure a cache for the given name using the corresponding XML configuration.
protected  BinaryStoreManager ensureFlashJournalRM(Cluster cluster)
          Ensure the FlashJournalRM is configured and started.
protected  JournalService ensureJournalService(Cluster cluster)
          Ensure the JournalService is registered as a cluster resource.
protected  BinaryStoreManager ensureRAMJournalRM(Cluster cluster)
          Ensure the RamJournalRM is configured and started.
 Service ensureService(java.lang.String sServiceName)
          Ensure a service for the given name using the corresponding XML configuration.
 Service ensureService(XmlElement xmlScheme)
          Ensure the service for the specified scheme.
protected  Service ensureServiceInternal(XmlElement xmlScheme)
          Ensure the service for the specified scheme.
protected  XmlElement findScheme(java.lang.String sSchemeName)
          In the configuration XML find a "scheme" element associated with a given scheme name.
protected static XmlElement findScheme(XmlElement xmlConfig, java.lang.String sSchemeName)
          In the specified configuration XML, find a "scheme" element associated with the specified scheme name.
 DefaultConfigurableCacheFactory.CacheInfo findSchemeMapping(java.lang.String sCacheName)
          In the configuration XML find a "cache-mapping" element associated with a given cache name.
protected  XmlElement findServiceScheme(java.lang.String sServiceName)
          In the configuration XML find a "scheme" element associated with a given service name.
 XmlElement getConfig()
          Obtain the factory configuration XML.
protected  java.lang.ClassLoader getConfigClassLoader()
          Return the class loader used to load the configuration for this factory.
protected  XmlElement getConfigUnsafe()
          Obtain a mutable reference to the factory configuration XML.
 java.lang.String getScopeName()
          Return the scope name for this ConfigurableCacheFactory.
protected  void initializeBundler(AbstractBundler bundler, XmlElement xmlBundle)
          Initialize the specified bundler using the "bundle-config" element.
 java.lang.Object instantiateAny(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlClass, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create an Object using "class-scheme" element.
protected  AsyncBinaryStore instantiateAsyncBinaryStore(BinaryStore store, int cbMaxAsync)
          Construct an AsyncBinaryStore using the specified parameters.
protected  AsyncBinaryStoreManager instantiateAsyncBinaryStoreManager(BinaryStoreManager storeMgr, int cbMaxAsync)
          Construct an AsyncBinaryStoreManager using the specified parameters.
protected  BackingMapManager instantiateBackingMapManager(int nSchemeType, XmlElement xmlScheme)
          Instantiate a BackingMapManager for a given scheme type.
protected  BinaryStoreManager instantiateBinaryStoreManager(XmlElement xmlConfig, java.lang.ClassLoader loader, boolean fPaged)
          Create a BinaryStoreManager using the specified XML configuration.
protected  BundlingNamedCache instantiateBundlingNamedCache(NamedCache cache, XmlElement xmlBundling)
          Create a BundlingNamedCache using the "operation-bundling" element.
protected  java.lang.Object instantiateCacheStore(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlStore, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a CacheLoader, CacheStore or BinaryEntryStore using the "cachestore-scheme" element.
protected  java.util.Map instantiateDiskBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlDisk, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Deprecated. As of Coherence 3.0, replaced by instantiateExternalBackingMap(com.tangosol.net.DefaultConfigurableCacheFactory.CacheInfo, com.tangosol.run.xml.XmlElement, com.tangosol.net.BackingMapManagerContext, java.lang.ClassLoader) and instantiatePagedExternalBackingMap(com.tangosol.net.DefaultConfigurableCacheFactory.CacheInfo, com.tangosol.run.xml.XmlElement, com.tangosol.net.BackingMapManagerContext, java.lang.ClassLoader)
protected  java.util.Map instantiateExternalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlExternal, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "external-scheme" element.
protected  java.util.Map instantiateFlashJournalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlJournal, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "flashjournal-scheme" element.
protected  java.util.Map instantiateLocalCache(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlLocal, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "local-scheme" element.
protected  LocalCache instantiateLocalCache(int cUnits, int cExpiryMillis)
          Construct a LocalCache using the specified parameters.
protected  java.util.Map instantiateMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlClass, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "class-scheme" element.
protected  MapListener instantiateMapListener(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlClass, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a MapListener using the using the "class-scheme" element.
protected  NearCache instantiateNearCache(java.util.Map mapFront, NamedCache mapBack, int nStrategy)
          Construct an NearCache using the specified parameters.
protected  java.util.Map instantiateOverflowBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlOverflow, BackingMapManagerContext context, java.lang.ClassLoader loader, java.util.Map mapListeners)
          Create a backing Map using the "overflow-scheme" element.
protected  OverflowMap instantiateOverflowMap(ObservableMap mapFront, java.util.Map mapBack, boolean fExpiry)
          Construct an OverflowMap using the specified parameters.
protected  java.util.Map instantiatePagedExternalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlPaged, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "paged-external-scheme" element.
protected  java.util.Map instantiateRamJournalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlJournal, BackingMapManagerContext context, java.lang.ClassLoader loader)
          Create a backing Map using the "ramjournal-scheme" element.
protected  ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, java.util.Map mapMisses, BinaryEntryStore storeBinary, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
          Construct a ReadWriteBackingMap using the specified parameters.
protected  ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, java.util.Map mapMisses, CacheLoader store, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
          Construct a ReadWriteBackingMap using the specified parameters.
protected  java.util.Map instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlRWBM, BackingMapManagerContext context, java.util.Map mapListeners)
          Create a ReadWriteBackingMap using the "read-write-backing-map-scheme" element.
protected  ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context, PartitionAwareBackingMap mapInternal, java.util.Map mapMisses, BinaryEntryStore storeBinary, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
          Construct a ReadWriteSplittingBackingMap using the specified parameters.
protected  ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context, PartitionAwareBackingMap mapInternal, java.util.Map mapMisses, CacheLoader store, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
          Construct a ReadWriteSplittingBackingMap using the specified parameters.
protected  SerializationCache instantiateSerializationCache(BinaryStore store, int cMax, boolean fBinaryMap)
          Construct an SerializationCache using the specified parameters.
protected  SerializationCache instantiateSerializationCache(BinaryStore store, int cMax, java.lang.ClassLoader loader)
          Construct an SerializationCache using the specified parameters.
protected  SerializationMap instantiateSerializationMap(BinaryStore store, boolean fBinaryMap)
          Construct an SerializationMap using the specified parameters.
protected  java.util.Map instantiateSerializationMap(BinaryStore store, boolean fBinaryMap, java.lang.ClassLoader loader, int cHighUnits, int cExpiryMillis, java.lang.String sSubclass, XmlElement xmlInitParams)
          Instantiate a SerializationMap, SerializationCache, SimpleSerializationMap, or any sub-class thereof.
protected  SerializationMap instantiateSerializationMap(BinaryStore store, java.lang.ClassLoader loader)
          Construct an SerializationMap using the specified parameters.
protected  SerializationPagedCache instantiateSerializationPagedCache(BinaryStoreManager storeMgr, int cPages, int cPageSecs, boolean fBinaryMap, boolean fPassive)
          Construct an SerializationPagedCache using the specified parameters.
protected  SerializationPagedCache instantiateSerializationPagedCache(BinaryStoreManager storeMgr, int cPages, int cPageSecs, java.lang.ClassLoader loader)
          Construct an SerializationPagedCache using the specified parameters.
protected  SimpleOverflowMap instantiateSimpleOverflowMap(ObservableMap mapFront, java.util.Map mapBack, java.util.Map mapMisses)
          Construct a SimpleOverflowMap using the specified parameters.
protected  SimpleSerializationMap instantiateSimpleSerializationMap(BinaryStore store, boolean fBinaryMap)
          Construct a SimpleSerializationMap using the specified parameters.
protected  SimpleSerializationMap instantiateSimpleSerializationMap(BinaryStore store, java.lang.ClassLoader loader)
          Construct a SimpleSerializationMap using the specified parameters.
 java.lang.Object instantiateSubclass(java.lang.String sClass, java.lang.Class clzSuper, java.lang.ClassLoader loader, java.lang.Object[] aoParam, XmlElement xmlParams)
          Construct an instance of the specified class using the specified parameters.
protected  VersionedBackingMap instantiateVersionedBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, java.util.Map mapMisses, CacheLoader loader, NamedCache mapVersionTransient, NamedCache mapVersionPersist, boolean fManageTransient)
          Construct a VersionedBackingMap using the specified parameters.
protected  VersionedBackingMap instantiateVersionedBackingMap(BackingMapManagerContext context, ObservableMap mapInternal, java.util.Map mapMisses, CacheStore store, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor, NamedCache mapVersionTransient, NamedCache mapVersionPersist, boolean fManageTransient)
          Construct a VersionedBackingMap using the specified parameters.
protected  java.util.Map instantiateVersionedBackingMap(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlVBM, BackingMapManagerContext context, java.util.Map mapListeners)
          Create a VersionedBackingMap using the "versioned-backing-map-scheme" element.
protected  VersionedNearCache instantiateVersionedNearCache(java.util.Map mapLocal, NamedCache mapDist, NamedCache mapVersion)
          Construct an VersionedNearCache using the specified parameters.
static boolean isPutAllOptimized(java.util.Map map)
          Determines whether or not the specified Map is optimized for a putAll() operation versus a regular put() operation.
protected  boolean isSerializerCompatible(Service serviceThis, Service serviceThat)
          Determines whether or not the serializers for the specified services are compatible.
static XmlDocument loadConfig(java.lang.String sName)
          Load the configuration from a file or resource.
static XmlDocument loadConfig(java.lang.String sName, java.lang.ClassLoader loader)
          Load the configuration from a file or resource.
static XmlDocument loadConfigAsResource(java.lang.String sResource, java.lang.ClassLoader loader)
          Load the configuration as a resource.
static XmlDocument loadConfigFromFile(java.io.File file)
          Load the configuration from a file or directory.
protected  java.lang.String popCacheContext()
          Pop cache context from a thread-local storage.
protected  void pushCacheContext(java.lang.String sContext)
          Push cache context into a thread-local storage.
protected  void register(CacheService service, java.lang.String sCacheName, java.lang.String sContext, java.util.Map map)
          Deprecated. as of Coherence 3.7.1; use MBeanHelper.registerCacheMBean(CacheService, String, String, Map) instead
protected  void register(NamedCache cache, java.lang.String sContext)
          Deprecated. as of Coherence 3.7.1; use MBeanHelper.registerCacheMBean(NamedCache, String) instead
protected  void registerBackingMapManager(BackingMapManager mgr)
          Register the specified BackingMapManager as a "valid" one.
protected  void release(BinaryStore store)
          Release all resources associated with the specified binary store.
protected  void release(CacheLoader loader)
          Release all resources associated with the specified loader.
 void release(java.util.Map map, java.util.Map mapListeners)
          Release all resources associated with the specified backing map.
 void releaseCache(NamedCache cache)
          Release a cache and its associated resources.
protected  void releaseCache(NamedCache cache, boolean fDestroy)
          Release a cache managed by this factory, optionally destroying it.
protected  void reportConversionError(XmlValue xmlValue, java.lang.String sType, java.lang.String sDefault, java.lang.RuntimeException e)
          Log a failed type conversion.
 XmlElement resolveBackingMapScheme(DefaultConfigurableCacheFactory.CacheInfo info, XmlElement xmlScheme)
          Traverse the specified scheme to find an enclosed "backing-map-scheme" or a scheme that could serve as such.
 XmlElement resolveScheme(DefaultConfigurableCacheFactory.CacheInfo info)
          In the configuration XML find a "scheme" element associated with a given cache and resolve it (recursively) using the "scheme-ref" elements.
protected  XmlElement resolveScheme(XmlElement xmlScheme, DefaultConfigurableCacheFactory.CacheInfo info, boolean fChild, boolean fRequired)
          Resolve the specified "XYZ-scheme" by retrieving the base element referred to by the "scheme-ref" element, resolving it recursively, and combining it with the specified overrides and cache specific attributes.
protected static XmlElement resolveScheme(XmlElement xmlConfig, XmlElement xmlScheme, DefaultConfigurableCacheFactory.CacheInfo info, boolean fChild, boolean fRequired, boolean fApply)
          Resolve the specified "XYZ-scheme" by retrieving the base element referred to by the "scheme-ref" element, resolving it recursively, and combining it with the specified overrides and cache specific attributes.
protected  void resolveSerializer(XmlElement xmlConfig)
          Resolve and inject service serializer elements based on defaults defined in the cache configuration.
protected  void resolveSocketProvider(XmlElement xmlConfig)
          Resolve and inject service socket-provider elements based on defaults defined in the cache configuration.
 void setConfig(XmlElement xmlConfig)
          Specify the factory configuration XML.
protected  void setConfigClassLoader(java.lang.ClassLoader loader)
          Set the class loader used to load the configuration for this factory.
 void setScopeName(java.lang.String sScopeName)
          Set the scope name for this ConfigurableCacheFactory.
 int translateSchemeType(java.lang.String sScheme)
          Translate the scheme name into the scheme type.
static int translateStandardSchemeType(java.lang.String sScheme)
          Translate the scheme name into the scheme type.
protected  void unregister(CacheService service, java.lang.String sCacheName)
          Deprecated. as of Coherence 3.7.1; use MBeanHelper.unregisterCacheMBean(CacheService, String) instead
protected  void unregister(java.lang.String sCacheName, java.lang.String sContext)
          Deprecated. as of Coherence 3.7.1; use MBeanHelper.unregisterCacheMBean(String, String) instead
protected  void validateBackingMapManager(CacheService service)
          Ensures that the backing map manager of the specified service was configured by this (or equivalent) factory.
protected  void verifyMapListener(DefaultConfigurableCacheFactory.CacheInfo info, java.util.Map map, XmlElement xmlScheme, BackingMapManagerContext context, java.lang.ClassLoader loader, java.util.Map mapListeners)
          Check whether or not a MapListener has to be instantiated and added to a Map according to a scheme definition.

 

Field Detail

FILE_CFG_CACHE

public static final java.lang.String FILE_CFG_CACHE
The default configuration file name.
See Also:
Constant Field Values

CACHE_NAME

public static final java.lang.String CACHE_NAME
The name of the replaceable parameter representing the cache name.
See Also:
Constant Field Values

CLASS_LOADER

public static final java.lang.String CLASS_LOADER
The name of the replaceable parameter representing the class loader.
See Also:
Constant Field Values

MGR_CONTEXT

public static final java.lang.String MGR_CONTEXT
The name of the replaceable parameter representing the backing map manager context.
See Also:
Constant Field Values

SCHEME_REF

public static final java.lang.String SCHEME_REF
The name of the replaceable parameter representing a scheme reference.
See Also:
Constant Field Values

CACHE_REF

public static final java.lang.String CACHE_REF
The name of the replaceable parameter representing a cache reference.
See Also:
Constant Field Values

JOURNAL_SERVICE_NAME

public static final java.lang.String JOURNAL_SERVICE_NAME
The name of the JournalService as a registered resource.
See Also:
Constant Field Values

SCHEME_UNKNOWN

public static final int SCHEME_UNKNOWN
The unknown scheme type.
See Also:
Constant Field Values

SCHEME_REPLICATED

public static final int SCHEME_REPLICATED
The replicated cache scheme.
See Also:
Constant Field Values

SCHEME_OPTIMISTIC

public static final int SCHEME_OPTIMISTIC
The optimistic cache scheme.
See Also:
Constant Field Values

SCHEME_DISTRIBUTED

public static final int SCHEME_DISTRIBUTED
The distributed cache scheme.
See Also:
Constant Field Values

SCHEME_NEAR

public static final int SCHEME_NEAR
The near cache scheme.
See Also:
Constant Field Values

SCHEME_VERSIONED_NEAR

public static final int SCHEME_VERSIONED_NEAR
The versioned near cache scheme.
See Also:
Constant Field Values

SCHEME_LOCAL

public static final int SCHEME_LOCAL
The local cache scheme.
See Also:
Constant Field Values

SCHEME_OVERFLOW

public static final int SCHEME_OVERFLOW
The overflow map scheme.
See Also:
Constant Field Values

SCHEME_DISK

public static final int SCHEME_DISK
Deprecated. As of Coherence 3.0, replaced by SCHEME_EXTERNAL and SCHEME_EXTERNAL_PAGED
The disk scheme.
See Also:
Constant Field Values

SCHEME_EXTERNAL

public static final int SCHEME_EXTERNAL
The external scheme.
See Also:
Constant Field Values

SCHEME_EXTERNAL_PAGED

public static final int SCHEME_EXTERNAL_PAGED
The paged-external scheme.
See Also:
Constant Field Values

SCHEME_CLASS

public static final int SCHEME_CLASS
The custom class scheme.
See Also:
Constant Field Values

SCHEME_READ_WRITE_BACKING

public static final int SCHEME_READ_WRITE_BACKING
The read write backing map scheme.
See Also:
Constant Field Values

SCHEME_VERSIONED_BACKING

public static final int SCHEME_VERSIONED_BACKING
The versioned backing map scheme.
See Also:
Constant Field Values

SCHEME_INVOCATION

public static final int SCHEME_INVOCATION
The invocation service scheme.
See Also:
Constant Field Values

SCHEME_PROXY

public static final int SCHEME_PROXY
The proxy service scheme.
See Also:
Constant Field Values

SCHEME_REMOTE_CACHE

public static final int SCHEME_REMOTE_CACHE
The remote cache scheme.
See Also:
Constant Field Values

SCHEME_REMOTE_INVOCATION

public static final int SCHEME_REMOTE_INVOCATION
The remote invocation scheme.
See Also:
Constant Field Values

SCHEME_TRANSACTIONAL

public static final int SCHEME_TRANSACTIONAL
The transactional cache scheme.
See Also:
Constant Field Values

SCHEME_FLASHJOURNAL

public static final int SCHEME_FLASHJOURNAL
The flash journal cache scheme.
See Also:
Constant Field Values

SCHEME_RAMJOURNAL

public static final int SCHEME_RAMJOURNAL
The ram journal cache scheme.
See Also:
Constant Field Values

m_store

protected ScopedReferenceStore m_store
Store that holds cache references scoped by class loader and optionally, if configured, Subject.

m_setManager

protected java.util.Set m_setManager
A Set of BackingMapManager instances registered by this factory.

Note: we rely on the BackingMapManager classes *not* to override the hashCode() and equals() methods.

Constructor Detail

DefaultConfigurableCacheFactory

public DefaultConfigurableCacheFactory()
Construct a default DefaultConfigurableCacheFactory using the default configuration file name.

DefaultConfigurableCacheFactory

public DefaultConfigurableCacheFactory(java.lang.String sPath)
Construct a DefaultConfigurableCacheFactory using the specified path to a "cache-config.dtd" compliant configuration file or resource.
Parameters:
sPath - the configuration resource name or file path

DefaultConfigurableCacheFactory

public DefaultConfigurableCacheFactory(java.lang.String sPath,
                                       java.lang.ClassLoader loader)
Construct a DefaultConfigurableCacheFactory using the specified path to a "cache-config.dtd" compliant configuration file or resource.
Parameters:
sPath - the configuration resource name or file path
loader - (optional) ClassLoader that should be used to load the configuration resource

DefaultConfigurableCacheFactory

public DefaultConfigurableCacheFactory(XmlElement xmlConfig)
Construct a DefaultConfigurableCacheFactory using the specified configuration XML.
Parameters:
xmlConfig - the configuration XmlElement

DefaultConfigurableCacheFactory

public DefaultConfigurableCacheFactory(XmlElement xmlConfig,
                                       java.lang.ClassLoader loader)
Construct a DefaultConfigurableCacheFactory using the specified configuration XML.
Parameters:
xmlConfig - the configuration XmlElement
loader - (optional) ClassLoader that should be used to load the configuration resource

Method Detail

getConfig

public XmlElement getConfig()
Obtain the factory configuration XML.
Specified by:
getConfig in interface ConfigurableCacheFactory
Specified by:
getConfig in interface XmlConfigurable
Returns:
the configuration XML

getConfigUnsafe

protected XmlElement getConfigUnsafe()
Obtain a mutable reference to the factory configuration XML.

Note: The caller may not modify the resulting XmlElement's in any way.

Returns:
the configuration XML

setConfig

public void setConfig(XmlElement xmlConfig)
Specify the factory configuration XML.
Specified by:
setConfig in interface ConfigurableCacheFactory
Specified by:
setConfig in interface XmlConfigurable
Parameters:
xmlConfig - the configuration XML

ensureCache

public NamedCache ensureCache(java.lang.String sCacheName,
                              java.lang.ClassLoader loader)
Ensure a cache for the given name using the corresponding XML configuration.
Specified by:
ensureCache in interface ConfigurableCacheFactory
Parameters:
sCacheName - the cache name
loader - ClassLoader that should be used to deserialize objects in the cache
Returns:
a NamedCache created according to the configuration XML

releaseCache

public void releaseCache(NamedCache cache)
Release a cache and its associated resources.

Releasing a cache makes it no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference. Any attempt to use the released cache reference afterword will result in an exception.

Specified by:
releaseCache in interface ConfigurableCacheFactory
Parameters:
cache - the cache to release

destroyCache

public void destroyCache(NamedCache cache)
Release and destroy this instance of NamedCache.

Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all internal and associated resources will be released.

Specified by:
destroyCache in interface ConfigurableCacheFactory
Parameters:
cache - the cache to release

ensureService

public Service ensureService(java.lang.String sServiceName)
Ensure a service for the given name using the corresponding XML configuration.
Specified by:
ensureService in interface ConfigurableCacheFactory
Parameters:
sServiceName - the service name
Returns:
a Service created according to the configuration XML

getScopeName

public java.lang.String getScopeName()
Return the scope name for this ConfigurableCacheFactory. If specified, this name will be used as a prefix for the name of all services created by this factory.
Returns:
the scope name for this ConfigurableCacheFactory; may be null

setScopeName

public void setScopeName(java.lang.String sScopeName)
Set the scope name for this ConfigurableCacheFactory. Note that this method should only be invoked by a CacheFactoryBuilder when initializing this ConfigurableCacheFactory instance.

This method will be removed in a future release.

Parameters:
sScopeName - the scope name for this ConfigurableCacheFactory
Throws:
java.lang.IllegalStateException - if this setter is invoked after a service start

getConfigClassLoader

protected java.lang.ClassLoader getConfigClassLoader()
Return the class loader used to load the configuration for this factory.
Returns:
the class loader to use for loading the config

checkPermission

protected static void checkPermission(NamedCache cache)
Check if the current user is allowed to "join" the cache.
Parameters:
cache - the cache
Throws:
java.lang.SecurityException - if permission is denied

setConfigClassLoader

protected void setConfigClassLoader(java.lang.ClassLoader loader)
Set the class loader used to load the configuration for this factory.
Parameters:
loader - the class loader to use for loading the config

loadConfig

public static XmlDocument loadConfig(java.lang.String sName)
Load the configuration from a file or resource.
Parameters:
sName - the name of file or resource.
Returns:
the configuration XML

loadConfig

public static XmlDocument loadConfig(java.lang.String sName,
                                     java.lang.ClassLoader loader)
Load the configuration from a file or resource.
Parameters:
sName - the name of file or resource.
loader - (optional) ClassLoader that should be used to load the configuration resource
Returns:
the configuration XML

loadConfigAsResource

public static XmlDocument loadConfigAsResource(java.lang.String sResource,
                                               java.lang.ClassLoader loader)
Load the configuration as a resource.
Parameters:
sResource - the resource name
loader - (optional) ClassLoader that should be used to load the configuration resource
Returns:
the configuration XML

loadConfigFromFile

public static XmlDocument loadConfigFromFile(java.io.File file)
Load the configuration from a file or directory.
Parameters:
file - file or directory to load the configuration from
Returns:
the configuration XML

findSchemeMapping

public DefaultConfigurableCacheFactory.CacheInfo findSchemeMapping(java.lang.String sCacheName)
In the configuration XML find a "cache-mapping" element associated with a given cache name.
Parameters:
sCacheName - the value of the "cache-name" element to look for
Returns:
a CacheInfo object associated with a given cache name

resolveScheme

public XmlElement resolveScheme(DefaultConfigurableCacheFactory.CacheInfo info)
In the configuration XML find a "scheme" element associated with a given cache and resolve it (recursively) using the "scheme-ref" elements. The returned XML is always a clone of the actual configuration and could be safely modified.
Parameters:
info - the cache info
Returns:
a resolved "scheme" element associated with a given cache

findScheme

protected XmlElement findScheme(java.lang.String sSchemeName)
In the configuration XML find a "scheme" element associated with a given scheme name.
Parameters:
sSchemeName - the value of the "scheme-name" element to look for
Returns:
a "scheme" element associated with a given scheme name

findScheme

protected static XmlElement findScheme(XmlElement xmlConfig,
                                       java.lang.String sSchemeName)
In the specified configuration XML, find a "scheme" element associated with the specified scheme name.
Parameters:
xmlConfig - the xml configuration
sSchemeName - the value of the "scheme-name" element to look for
Returns:
a "scheme" element associated with a given scheme name, or null if none is found

collectServiceSchemes

public static java.util.Map collectServiceSchemes(XmlElement xmlConfig)
Collect a map keyed by service names with values of corresponding service schemes in the specified cache configuration.
Parameters:
xmlConfig - the cache configuration
Returns:
a map keyed by service names with values of service schemes

collectServiceSchemes

protected static void collectServiceSchemes(XmlElement xmlScheme,
                                            XmlElement xmlConfig,
                                            java.util.HashMap mapService)
Collect the service-schemes referenced by the specified scheme element in the cache configuration and update the specified mapping of service names to the associated service schemes.
Parameters:
xmlScheme - a scheme element
xmlConfig - the cache configuration
mapService - a map of service name to service scheme

findServiceScheme

protected XmlElement findServiceScheme(java.lang.String sServiceName)
In the configuration XML find a "scheme" element associated with a given service name.
Parameters:
sServiceName - the value of the "service-name" element to look for
Returns:
a "scheme" element associated with a given service name

resolveScheme

protected static XmlElement resolveScheme(XmlElement xmlConfig,
                                          XmlElement xmlScheme,
                                          DefaultConfigurableCacheFactory.CacheInfo info,
                                          boolean fChild,
                                          boolean fRequired,
                                          boolean fApply)
Resolve the specified "XYZ-scheme" by retrieving the base element referred to by the "scheme-ref" element, resolving it recursively, and combining it with the specified overrides and cache specific attributes.
Parameters:
xmlConfig - the cache configuration xml
xmlScheme - a scheme element to resolve
info - the cache info (optional)
fChild - if true, the actual cache scheme is the only "xyz-scheme" child of the specified xmlScheme element; otherwise it's the xmlScheme element itself
fRequired - if true, the child scheme must be present; false otherwise
fApply - if true, apply the specified overrides and cache-specific attributes to the base scheme element; otherwise return a reference to the base scheme element
Returns:
a "scheme" element referred to by the "scheme-ref" value; null if the child is missing and is not required

resolveScheme

protected XmlElement resolveScheme(XmlElement xmlScheme,
                                   DefaultConfigurableCacheFactory.CacheInfo info,
                                   boolean fChild,
                                   boolean fRequired)
Resolve the specified "XYZ-scheme" by retrieving the base element referred to by the "scheme-ref" element, resolving it recursively, and combining it with the specified overrides and cache specific attributes.
Parameters:
xmlScheme - a scheme element to resolve
info - the cache info (optional)
fChild - if true, the actual cache scheme is the only "xyz-scheme" child of the specified xmlScheme element; otherwise it's the xmlScheme element itself
fRequired - if true, the child scheme must be present; false otherwise
Returns:
a "scheme" element associated with a given cache name; null if the child is missing and is not required

ensureCache

protected NamedCache ensureCache(DefaultConfigurableCacheFactory.CacheInfo info,
                                 XmlElement xmlScheme,
                                 java.lang.ClassLoader loader)
Obtain the NamedCache reference for the cache service defined by the specified scheme.
Parameters:
info - the cache info
xmlScheme - the scheme element for the cache
loader - (optional) ClassLoader that should be used to deserialize objects in the cache
Returns:
NamedCache instance

ensureService

public Service ensureService(XmlElement xmlScheme)
Ensure the service for the specified scheme.
Parameters:
xmlScheme - the scheme
Returns:
running Service corresponding to the scheme

ensureServiceInternal

protected Service ensureServiceInternal(XmlElement xmlScheme)
Ensure the service for the specified scheme.
Parameters:
xmlScheme - the scheme
Returns:
running Service corresponding to the scheme

applyScopeToServiceName

protected java.lang.String applyScopeToServiceName(java.lang.String sServiceName)
Apply the scope name prefix to the given service name. The name will be formatted as such: [scope name]:[service name]
Parameters:
sServiceName - the service name
Returns:
the service name with scope prefix, if there is a scope name configured

resolveSerializer

protected void resolveSerializer(XmlElement xmlConfig)
Resolve and inject service serializer elements based on defaults defined in the cache configuration.
Parameters:
xmlConfig - the configuration element to examine and modify

resolveSocketProvider

protected void resolveSocketProvider(XmlElement xmlConfig)
Resolve and inject service socket-provider elements based on defaults defined in the cache configuration.
Parameters:
xmlConfig - the configuration element to examine and modify

instantiateBackingMapManager

protected BackingMapManager instantiateBackingMapManager(int nSchemeType,
                                                         XmlElement xmlScheme)
Instantiate a BackingMapManager for a given scheme type.

Note: we rely on the BackingMapManager implementations to have their equals() method test for object identity using the "==" operator (in other words not to override the hashCode() and equals() methods).

Parameters:
nSchemeType - the scheme type (one of the SCHEME-* constants)
xmlScheme - the scheme used to configure the corresponding service
Returns:
a new BackingMapManager instance

registerBackingMapManager

protected void registerBackingMapManager(BackingMapManager mgr)
Register the specified BackingMapManager as a "valid" one. That registry is used to identify services configured and started by this factory and prevent accidental usage of (potentially incompatible) cache services with the same name created by other factories.
Parameters:
mgr - a BackingMapManager instance instantiated by this factory

validateBackingMapManager

protected void validateBackingMapManager(CacheService service)
Ensures that the backing map manager of the specified service was configured by this (or equivalent) factory. This validation is performed to prevent accidental usage of (potentially incompatible) cache services with the same name created by other factories.
Parameters:
service - the CacheService to validate

configureCache

public NamedCache configureCache(DefaultConfigurableCacheFactory.CacheInfo info,
                                 XmlElement xmlScheme,
                                 java.lang.ClassLoader loader)
Ensures a cache for given scheme.
Parameters:
info - the cache info
xmlScheme - the corresponding scheme
loader - ClassLoader that should be used to deserialize objects in the cache
Returns:
a named cache created according to the description in the configuration

instantiateNearCache

protected NearCache instantiateNearCache(java.util.Map mapFront,
                                         NamedCache mapBack,
                                         int nStrategy)
Construct an NearCache using the specified parameters.

This method exposes a corresponding NearCache constructor and is provided for the express purpose of allowing its override.


instantiateVersionedNearCache

protected VersionedNearCache instantiateVersionedNearCache(java.util.Map mapLocal,
                                                           NamedCache mapDist,
                                                           NamedCache mapVersion)
Construct an VersionedNearCache using the specified parameters.

This method exposes a corresponding VersionedNearCache constructor and is provided for the express purpose of allowing its override.


configureBackingMap

public java.util.Map configureBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                         XmlElement xmlScheme,
                                         BackingMapManagerContext context,
                                         java.lang.ClassLoader loader,
                                         java.util.Map mapListeners)
Configures a backing map according to the scheme.
Parameters:
info - the cache info
xmlScheme - the scheme element for cache configuration
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
mapListeners - map of registered map listeners keyed by the corresponding map references
Returns:
a backing map configured according to the scheme

resolveBackingMapScheme

public XmlElement resolveBackingMapScheme(DefaultConfigurableCacheFactory.CacheInfo info,
                                          XmlElement xmlScheme)
Traverse the specified scheme to find an enclosed "backing-map-scheme" or a scheme that could serve as such.
Parameters:
info - the cache info
xmlScheme - the scheme element for cache configuration
Returns:
the resolved backing map scheme

verifyMapListener

protected void verifyMapListener(DefaultConfigurableCacheFactory.CacheInfo info,
                                 java.util.Map map,
                                 XmlElement xmlScheme,
                                 BackingMapManagerContext context,
                                 java.lang.ClassLoader loader,
                                 java.util.Map mapListeners)
Check whether or not a MapListener has to be instantiated and added to a Map according to a scheme definition.
Parameters:
info - the cache info
map - an ObservableMap to add a listener to
xmlScheme - the corresponding scheme
context - BackingMapManagerContext to be used
loader - ClassLoader that should be used to instantiate a MapListener object
mapListeners - map of registered map listeners keyed by the corresponding map references
Throws:
java.lang.IllegalArgumentException - if the listener is required, but the map does not implement ObservableMap interface or if the listener cannot be instantiated

instantiateReadWriteBackingMap

protected java.util.Map instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                       XmlElement xmlRWBM,
                                                       BackingMapManagerContext context,
                                                       java.util.Map mapListeners)
Create a ReadWriteBackingMap using the "read-write-backing-map-scheme" element.
Parameters:
info - the cache info
xmlRWBM - "read-write-backing-map-scheme" element
context - BackingMapManagerContext to be used
mapListeners - map of registered map listeners keyed by the corresponding map references
Returns:
a newly instantiated Map

instantiateReadWriteBackingMap

protected ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context,
                                                             ObservableMap mapInternal,
                                                             java.util.Map mapMisses,
                                                             CacheLoader store,
                                                             boolean fReadOnly,
                                                             int cWriteBehindSeconds,
                                                             double dflRefreshAheadFactor)
Construct a ReadWriteBackingMap using the specified parameters.

This method exposes a corresponding ReadWriteBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateReadWriteBackingMap

protected ReadWriteBackingMap instantiateReadWriteBackingMap(BackingMapManagerContext context,
                                                             ObservableMap mapInternal,
                                                             java.util.Map mapMisses,
                                                             BinaryEntryStore storeBinary,
                                                             boolean fReadOnly,
                                                             int cWriteBehindSeconds,
                                                             double dflRefreshAheadFactor)
Construct a ReadWriteBackingMap using the specified parameters.

This method exposes a corresponding ReadWriteBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateReadWriteSplittingBackingMap

protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context,
                                                                               PartitionAwareBackingMap mapInternal,
                                                                               java.util.Map mapMisses,
                                                                               CacheLoader store,
                                                                               boolean fReadOnly,
                                                                               int cWriteBehindSeconds,
                                                                               double dflRefreshAheadFactor)
Construct a ReadWriteSplittingBackingMap using the specified parameters.

This method exposes a corresponding ReadWriteSplittingBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateReadWriteSplittingBackingMap

protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap(BackingMapManagerContext context,
                                                                               PartitionAwareBackingMap mapInternal,
                                                                               java.util.Map mapMisses,
                                                                               BinaryEntryStore storeBinary,
                                                                               boolean fReadOnly,
                                                                               int cWriteBehindSeconds,
                                                                               double dflRefreshAheadFactor)
Construct a ReadWriteSplittingBackingMap using the specified parameters.

This method exposes a corresponding ReadWriteSplittingBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateVersionedBackingMap

protected java.util.Map instantiateVersionedBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                       XmlElement xmlVBM,
                                                       BackingMapManagerContext context,
                                                       java.util.Map mapListeners)
Create a VersionedBackingMap using the "versioned-backing-map-scheme" element.
Parameters:
info - the cache info
xmlVBM - "versioned-backing-map-scheme" element
context - BackingMapManagerContext to be used
mapListeners - map of registered map listeners keyed by the corresponding map references
Returns:
a newly instantiated Map

instantiateVersionedBackingMap

protected VersionedBackingMap instantiateVersionedBackingMap(BackingMapManagerContext context,
                                                             ObservableMap mapInternal,
                                                             java.util.Map mapMisses,
                                                             CacheStore store,
                                                             boolean fReadOnly,
                                                             int cWriteBehindSeconds,
                                                             double dflRefreshAheadFactor,
                                                             NamedCache mapVersionTransient,
                                                             NamedCache mapVersionPersist,
                                                             boolean fManageTransient)
Construct a VersionedBackingMap using the specified parameters.

This method exposes a corresponding VersionedBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateVersionedBackingMap

protected VersionedBackingMap instantiateVersionedBackingMap(BackingMapManagerContext context,
                                                             ObservableMap mapInternal,
                                                             java.util.Map mapMisses,
                                                             CacheLoader loader,
                                                             NamedCache mapVersionTransient,
                                                             NamedCache mapVersionPersist,
                                                             boolean fManageTransient)
Construct a VersionedBackingMap using the specified parameters.

This method exposes a corresponding VersionedBackingMap constructor and is provided for the express purpose of allowing its override.


instantiateLocalCache

protected java.util.Map instantiateLocalCache(DefaultConfigurableCacheFactory.CacheInfo info,
                                              XmlElement xmlLocal,
                                              BackingMapManagerContext context,
                                              java.lang.ClassLoader loader)
Create a backing Map using the "local-scheme" element.
Parameters:
info - the cache info
xmlLocal - "local-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

configureUnitCalculator

protected void configureUnitCalculator(XmlElement xmlCache,
                                       ConfigurableCacheMap cache,
                                       DefaultConfigurableCacheFactory.CacheInfo info,
                                       BackingMapManagerContext context,
                                       java.lang.ClassLoader loader)
Configure a UnitCalculator for the specified ConfigurableCacheMap.
Parameters:
xmlCache - cache scheme that may contain a "unit-calculator" element
cache - the corresponding ConfigurableCacheMap
info - the cache info
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes

instantiateLocalCache

protected LocalCache instantiateLocalCache(int cUnits,
                                           int cExpiryMillis)
Construct a LocalCache using the specified parameters.

This method exposes a corresponding LocalCache constructor and is provided for the express purpose of allowing its override.

Parameters:
cUnits - high watermark
cExpiryMillis - the expiry value
Returns:
a newly instantiated LocalCache

instantiateOverflowBackingMap

protected java.util.Map instantiateOverflowBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                      XmlElement xmlOverflow,
                                                      BackingMapManagerContext context,
                                                      java.lang.ClassLoader loader,
                                                      java.util.Map mapListeners)
Create a backing Map using the "overflow-scheme" element.
Parameters:
info - the cache info
xmlOverflow - "overflow-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
mapListeners - map of registered map listeners keyed by the corresponding map references
Returns:
a newly instantiated Map

instantiateOverflowMap

protected OverflowMap instantiateOverflowMap(ObservableMap mapFront,
                                             java.util.Map mapBack,
                                             boolean fExpiry)
Construct an OverflowMap using the specified parameters.

This method exposes a corresponding OverflowMap constructor and is provided for the express purpose of allowing its override.


instantiateSimpleOverflowMap

protected SimpleOverflowMap instantiateSimpleOverflowMap(ObservableMap mapFront,
                                                         java.util.Map mapBack,
                                                         java.util.Map mapMisses)
Construct a SimpleOverflowMap using the specified parameters.

This method exposes a corresponding SimpleOverflowMap constructor and is provided for the express purpose of allowing its override.


instantiateDiskBackingMap

protected java.util.Map instantiateDiskBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                  XmlElement xmlDisk,
                                                  BackingMapManagerContext context,
                                                  java.lang.ClassLoader loader)
Deprecated. As of Coherence 3.0, replaced by instantiateExternalBackingMap(com.tangosol.net.DefaultConfigurableCacheFactory.CacheInfo, com.tangosol.run.xml.XmlElement, com.tangosol.net.BackingMapManagerContext, java.lang.ClassLoader) and instantiatePagedExternalBackingMap(com.tangosol.net.DefaultConfigurableCacheFactory.CacheInfo, com.tangosol.run.xml.XmlElement, com.tangosol.net.BackingMapManagerContext, java.lang.ClassLoader)
Create a backing Map using the "disk-scheme" element.
Parameters:
info - the cache info
xmlDisk - "disk-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

instantiateSerializationMap

protected java.util.Map instantiateSerializationMap(BinaryStore store,
                                                    boolean fBinaryMap,
                                                    java.lang.ClassLoader loader,
                                                    int cHighUnits,
                                                    int cExpiryMillis,
                                                    java.lang.String sSubclass,
                                                    XmlElement xmlInitParams)
Instantiate a SerializationMap, SerializationCache, SimpleSerializationMap, or any sub-class thereof.
Parameters:
store - a BinaryStore to use to write serialized data to
fBinaryMap - true if the only data written to the Map will already be in Binary form
loader - the ClassLoader to use (if not a Binary map)
cHighUnits - the max size in units for the serialization cache
cExpiryMillis - the expiry time in milliseconds for the cache
sSubclass - the sub-class name (or "")
xmlInitParams - the init params for the sub-class
Returns:
a BinaryMap, SerializationMap, SerializationCache, SimpleSerializationMap, or a subclass thereof

instantiateExternalBackingMap

protected java.util.Map instantiateExternalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                      XmlElement xmlExternal,
                                                      BackingMapManagerContext context,
                                                      java.lang.ClassLoader loader)
Create a backing Map using the "external-scheme" element.
Parameters:
info - the cache info
xmlExternal - "external-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

instantiatePagedExternalBackingMap

protected java.util.Map instantiatePagedExternalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                           XmlElement xmlPaged,
                                                           BackingMapManagerContext context,
                                                           java.lang.ClassLoader loader)
Create a backing Map using the "paged-external-scheme" element.
Parameters:
info - the cache info
xmlPaged - "paged-external-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

instantiateFlashJournalBackingMap

protected java.util.Map instantiateFlashJournalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                          XmlElement xmlJournal,
                                                          BackingMapManagerContext context,
                                                          java.lang.ClassLoader loader)
Create a backing Map using the "flashjournal-scheme" element.
Parameters:
info - the cache info
xmlJournal - "flashjournal-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

instantiateRamJournalBackingMap

protected java.util.Map instantiateRamJournalBackingMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                                        XmlElement xmlJournal,
                                                        BackingMapManagerContext context,
                                                        java.lang.ClassLoader loader)
Create a backing Map using the "ramjournal-scheme" element.
Parameters:
info - the cache info
xmlJournal - "ramjournal-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

ensureRAMJournalRM

protected BinaryStoreManager ensureRAMJournalRM(Cluster cluster)
Ensure the RamJournalRM is configured and started.
Parameters:
cluster - the Cluster for which the RamJournalRM is storing data
Returns:
the RamJournalRM as a BinaryStoreManager

ensureFlashJournalRM

protected BinaryStoreManager ensureFlashJournalRM(Cluster cluster)
Ensure the FlashJournalRM is configured and started.
Parameters:
cluster - the Cluster for which the FlashJournalRM is storing data
Returns:
the FlashJournalRM as a BinaryStoreManager

ensureBackupJournalRM

protected BinaryStoreManager ensureBackupJournalRM(Cluster cluster)
Ensure the BackupJournalRM is configured and started.
Parameters:
cluster - the Cluster for which the BackupJournalRM is storing data
Returns:
the BackupJournalRM as a BinaryStoreManager

ensureJournalService

protected JournalService ensureJournalService(Cluster cluster)
Ensure the JournalService is registered as a cluster resource.
Parameters:
cluster - the Cluster for which the JournalService is storing data
Returns:
the JournalService

instantiateBinaryStoreManager

protected BinaryStoreManager instantiateBinaryStoreManager(XmlElement xmlConfig,
                                                           java.lang.ClassLoader loader,
                                                           boolean fPaged)
Create a BinaryStoreManager using the specified XML configuration. The given XML configuration must contain a valid child BinaryStoreManager element:
Parameters:
xmlConfig - the XmlElement that contains the configuration info for the BinaryStoreManager that will be instantiated
loader - the ClassLoader to instantiate necessary classes
fPaged - flag indicating whether or not the returned BinaryStoreManager will be used by a SerializationPagedCache
Returns:
a newly instantiated BinaryStoreManager created using the given XML configuration

instantiateAsyncBinaryStore

protected AsyncBinaryStore instantiateAsyncBinaryStore(BinaryStore store,
                                                       int cbMaxAsync)
Construct an AsyncBinaryStore using the specified parameters.
Parameters:
store - the BinaryStore to make asynchronous
cbMaxAsync - the maximum amount of "async writes" data that will be queued
Returns:
a new AsyncBinaryStore wrapping the passed BinaryStore

instantiateAsyncBinaryStoreManager

protected AsyncBinaryStoreManager instantiateAsyncBinaryStoreManager(BinaryStoreManager storeMgr,
                                                                     int cbMaxAsync)
Construct an AsyncBinaryStoreManager using the specified parameters.
Parameters:
storeMgr - the BinaryStoreManager to make asynchronous
cbMaxAsync - the maximum amount of "async writes" data that will be queued
Returns:
a new AsyncBinaryStoreManager wrapping the passed BinaryStoreManager

instantiateSerializationPagedCache

protected SerializationPagedCache instantiateSerializationPagedCache(BinaryStoreManager storeMgr,
                                                                     int cPages,
                                                                     int cPageSecs,
                                                                     java.lang.ClassLoader loader)
Construct an SerializationPagedCache using the specified parameters.

This method exposes a corresponding SerializationPagedCache constructor and is provided for the express purpose of allowing its override.


instantiateSerializationPagedCache

protected SerializationPagedCache instantiateSerializationPagedCache(BinaryStoreManager storeMgr,
                                                                     int cPages,
                                                                     int cPageSecs,
                                                                     boolean fBinaryMap,
                                                                     boolean fPassive)
Construct an SerializationPagedCache using the specified parameters.

This method exposes a corresponding SerializationPagedCache constructor and is provided for the express purpose of allowing its override.


instantiateSerializationCache

protected SerializationCache instantiateSerializationCache(BinaryStore store,
                                                           int cMax,
                                                           java.lang.ClassLoader loader)
Construct an SerializationCache using the specified parameters.

This method exposes a corresponding SerializationCache constructor and is provided for the express purpose of allowing its override.


instantiateSerializationCache

protected SerializationCache instantiateSerializationCache(BinaryStore store,
                                                           int cMax,
                                                           boolean fBinaryMap)
Construct an SerializationCache using the specified parameters.

This method exposes a corresponding SerializationCache constructor and is provided for the express purpose of allowing its override.


instantiateSerializationMap

protected SerializationMap instantiateSerializationMap(BinaryStore store,
                                                       java.lang.ClassLoader loader)
Construct an SerializationMap using the specified parameters.

This method exposes a corresponding SerializationMap constructor and is provided for the express purpose of allowing its override.


instantiateSerializationMap

protected SerializationMap instantiateSerializationMap(BinaryStore store,
                                                       boolean fBinaryMap)
Construct an SerializationMap using the specified parameters.

This method exposes a corresponding SerializationMap constructor and is provided for the express purpose of allowing its override.


instantiateSimpleSerializationMap

protected SimpleSerializationMap instantiateSimpleSerializationMap(BinaryStore store,
                                                                   java.lang.ClassLoader loader)
Construct a SimpleSerializationMap using the specified parameters.

This method exposes a corresponding SerializationMap constructor and is provided for the express purpose of allowing its override.

Since:
Coherence 3.7

instantiateSimpleSerializationMap

protected SimpleSerializationMap instantiateSimpleSerializationMap(BinaryStore store,
                                                                   boolean fBinaryMap)
Construct a SimpleSerializationMap using the specified parameters.

This method exposes a corresponding SerializationMap constructor and is provided for the express purpose of allowing its override.

Since:
Coherence 3.7

instantiateBundlingNamedCache

protected BundlingNamedCache instantiateBundlingNamedCache(NamedCache cache,
                                                           XmlElement xmlBundling)
Create a BundlingNamedCache using the "operation-bundling" element.
Parameters:
cache - the wrapped cache
xmlBundling - the "operation-bundling" element
Returns:
a newly instantiated BundlingNamedCache

initializeBundler

protected void initializeBundler(AbstractBundler bundler,
                                 XmlElement xmlBundle)
Initialize the specified bundler using the "bundle-config" element.
Parameters:
bundler - the bundler
xmlBundle - a "bundle-config" element

instantiateMap

protected java.util.Map instantiateMap(DefaultConfigurableCacheFactory.CacheInfo info,
                                       XmlElement xmlClass,
                                       BackingMapManagerContext context,
                                       java.lang.ClassLoader loader)
Create a backing Map using the "class-scheme" element. This method is a thin wrapper around instantiateAny.
Parameters:
info - the cache info
xmlClass - "class-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Map

instantiateCacheStore

protected java.lang.Object instantiateCacheStore(DefaultConfigurableCacheFactory.CacheInfo info,
                                                 XmlElement xmlStore,
                                                 BackingMapManagerContext context,
                                                 java.lang.ClassLoader loader)
Create a CacheLoader, CacheStore or BinaryEntryStore using the "cachestore-scheme" element.
Parameters:
info - the cache info
xmlStore - "cachestore-scheme" element for the store or loader
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated CacheLoader, CacheStore or BinaryEntryStore

instantiateMapListener

protected MapListener instantiateMapListener(DefaultConfigurableCacheFactory.CacheInfo info,
                                             XmlElement xmlClass,
                                             BackingMapManagerContext context,
                                             java.lang.ClassLoader loader)
Create a MapListener using the using the "class-scheme" element. If the value of any "param-value" element contains the literal "{cache-name}", replace it with the actual cache name.
Parameters:
info - the cache info
xmlClass - "class-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated MapListener

instantiateAny

public java.lang.Object instantiateAny(DefaultConfigurableCacheFactory.CacheInfo info,
                                       XmlElement xmlClass,
                                       BackingMapManagerContext context,
                                       java.lang.ClassLoader loader)
Create an Object using "class-scheme" element.

If the value of any "param-value" element contains the literal "{cache-name}", replace it with the actual cache name.
If the value of "param-value" element is "{class-loader}" and "param-type" element is "java.lang.ClassLoader" replace it with the current ClassLoader object.
If the value of "param-value" element is "{manager-context}" and "param-type" element is "com.tangosol.net.BackingMapManagerContext" replace it with the current BackingMapManagerContext object.
Finally, if the value of "param-type" is "{scheme-ref}" then the "param-value" should be a name of the scheme that will be used in place of the value.

Parameters:
info - the cache info
xmlClass - "class-scheme" element
context - BackingMapManagerContext to be used
loader - the ClassLoader to instantiate necessary classes
Returns:
a newly instantiated Object

instantiateSubclass

public java.lang.Object instantiateSubclass(java.lang.String sClass,
                                            java.lang.Class clzSuper,
                                            java.lang.ClassLoader loader,
                                            java.lang.Object[] aoParam,
                                            XmlElement xmlParams)
Construct an instance of the specified class using the specified parameters.
Parameters:
sClass - the class name
clzSuper - the super class of the newly instantiated class
loader - the ClassLoader to instantiate necessary classes
aoParam - the constructor parameters
xmlParams - the "init-params" XmlElement (optional)
Returns:
a newly instantiated Object

release

public void release(java.util.Map map,
                    java.util.Map mapListeners)
Release all resources associated with the specified backing map.
Parameters:
map - the map being released
mapListeners - map of registered map listeners keyed by the corresponding map references

release

protected void release(CacheLoader loader)
Release all resources associated with the specified loader.
Parameters:
loader - the cache loader being released

release

protected void release(BinaryStore store)
Release all resources associated with the specified binary store.
Parameters:
store - the binary store being released

releaseCache

protected void releaseCache(NamedCache cache,
                            boolean fDestroy)
Release a cache managed by this factory, optionally destroying it.
Parameters:
cache - the cache to release
fDestroy - true to destroy the cache as well

translateSchemeType

public int translateSchemeType(java.lang.String sScheme)
Translate the scheme name into the scheme type. Valid scheme types are any of the SCHEME_* constants.
Parameters:
sScheme - the scheme name
Returns:
the scheme type

translateStandardSchemeType

public static int translateStandardSchemeType(java.lang.String sScheme)
Translate the scheme name into the scheme type. Valid scheme types are any of the SCHEME_* constants.
Parameters:
sScheme - the scheme name
Returns:
the scheme type

isPutAllOptimized

public static boolean isPutAllOptimized(java.util.Map map)
Determines whether or not the specified Map is optimized for a putAll() operation versus a regular put() operation.
Parameters:
map - a Map instance to check
Returns:
true if putAll should be preferred over put if the return value is not needed; false otherwise

isSerializerCompatible

protected boolean isSerializerCompatible(Service serviceThis,
                                         Service serviceThat)
Determines whether or not the serializers for the specified services are compatible. In other words, this method returns true iff object serialized with the first Serializer can be deserialized by the second and visa versa.
Parameters:
serviceThis - the first Service
serviceThat - the second Service
Returns:
true iff the two Serializers are stream compatible

register

protected void register(NamedCache cache,
                        java.lang.String sContext)
Deprecated. as of Coherence 3.7.1; use MBeanHelper.registerCacheMBean(NamedCache, String) instead
Register the specified NamedCache with the cluster registry.
Parameters:
cache - the NamedCache object to register
sContext - the cache context (tier)

register

protected void register(CacheService service,
                        java.lang.String sCacheName,
                        java.lang.String sContext,
                        java.util.Map map)
Deprecated. as of Coherence 3.7.1; use MBeanHelper.registerCacheMBean(CacheService, String, String, Map) instead
Register the specified cache with the cluster registry.
Parameters:
service - the CacheService that the cache belongs to
sCacheName - the cache name
sContext - the cache context (tier)
map - the cache object to register

unregister

protected void unregister(CacheService service,
                          java.lang.String sCacheName)
Deprecated. as of Coherence 3.7.1; use MBeanHelper.unregisterCacheMBean(CacheService, String) instead
Unregister all the managed objects that belong to the specified cache from the cluster registry.
Parameters:
service - the CacheService that the cache belongs to
sCacheName - the cache name

unregister

protected void unregister(java.lang.String sCacheName,
                          java.lang.String sContext)
Deprecated. as of Coherence 3.7.1; use MBeanHelper.unregisterCacheMBean(String, String) instead
Unregister the caches for a given cache name and context from the cluster registry.
Parameters:
sCacheName - the cache name
sContext - the cache context (tier)

pushCacheContext

protected void pushCacheContext(java.lang.String sContext)
Push cache context into a thread-local storage.
Parameters:
sContext - cache context (tag)

popCacheContext

protected java.lang.String popCacheContext()
Pop cache context from a thread-local storage.
Returns:
the popped cache context

convertInt

protected int convertInt(XmlValue xmlValue)
Convert the value in the specified XmlValue to an int. If the conversion fails, a warning will be logged.
Parameters:
xmlValue - the element expected to contain an int value
Returns:
the int value in the provided element, or 0 upon a conversion failure

convertInt

protected int convertInt(XmlValue xmlValue,
                         int nDefault)
Convert the value in the specified XmlValue to an int. If the conversion fails, a warning will be logged.
Parameters:
xmlValue - the element expected to contain an int value
nDefault - the value that will be returned if the element does not contain a value that can be converted to int
Returns:
the int value in the provided element, or nDefault upon a conversion failure

convertLong

protected long convertLong(XmlValue xmlValue)
Convert the value in the specified XmlValue to a long. If the conversion fails, a warning will be logged.
Parameters:
xmlValue - the element expected to contain a long value
Returns:
the long value in the provided element, or 0 upon a conversion failure

convertDouble

protected double convertDouble(XmlValue xmlValue)
Convert the value in the specified XmlValue to a double. If the conversion fails, a warning will be logged.
Parameters:
xmlValue - the element expected to contain a double value
Returns:
the double value in the provided element, or 0.0 upon a conversion failure

reportConversionError

protected void reportConversionError(XmlValue xmlValue,
                                     java.lang.String sType,
                                     java.lang.String sDefault,
                                     java.lang.RuntimeException e)
Log a failed type conversion.
Parameters:
xmlValue - element that contains the value that failed conversion
sType - type that conversion was attempted to
sDefault - default value that will be substituted
e - root cause of failed type conversion

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.