|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.ExtensibleConfigurableCacheFactory
public class ExtensibleConfigurableCacheFactory
ExtensibleConfigurableCacheFactory provides a facility to access caches declared in a "coherence-cache-config.xsd" compliant configuration file.
It is strongly recommended that developers get a ConfigurableCacheFactory instance via CacheFactory.getCacheFactoryBuilder().getConfigurableCacheFactory(), rather than instantiate an ExtensibleConfigurableCacheFactory instance directly.
There are various ways of using this factory:
ConfigurableCacheFactory factory = new ExtensibleConfigurableCacheFactory(sPath); ... ClassLoader loader = getClass().getClassLoader(); NamedCache cacheOne = factory.ensureCache("one", loader); NamedCache cacheTwo = factory.ensureCache("two", loader);
Another option is using the static version of the "ensureCache" call:
ClassLoader loader = getClass().getClassLoader(); NamedCache cacheOne = CacheFactory.getCache("one", loader);
which uses an instance of ConfigurableCacheFactory obtained by CacheFactory.getConfigurableCacheFactory()
.
CacheFactory.getCache(String, ClassLoader)
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. |
protected com.tangosol.net.events.internal.ConfigurableCacheFactoryDispatcher |
f_dispatcher ConfigurableCacheFactoryDispatcher linked to this cache factory. |
protected com.tangosol.net.internal.ScopedReferenceStore |
f_store Store that holds cache references scoped by class loader and optionally, if configured, Subject. |
static java.lang.String |
FILE_CFG_CACHE The default configuration file name. |
protected boolean |
m_fActivated Indicates whether this factory has been activated. |
protected boolean |
m_fDisposed Indicates whether this factory has been disposed. |
protected ScopeResolver |
m_scopeResolver The ScopeResolver used for modifying the scope name in the cache configuration. |
protected java.util.Set |
m_setManager A Set of BackingMapManager instances registered by this factory. |
protected java.util.Set |
m_setServices Set used to hold references to services that are ensured by this factory. |
static java.util.HashMap |
MAP_SCHEMETYPE_BY_SCHEMENAME The mappings from scheme name to scheme type. |
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 | |
---|---|
ExtensibleConfigurableCacheFactory(ExtensibleConfigurableCacheFactory.Dependencies dependencies) Constructs an ExtensibleConfigurableCacheFactory using the specified ExtensibleConfigurableCacheFactory.Dependencies . |
Method Summary | |
---|---|
void |
activate() Activate prepares the factory to be used within a container and should be called before any other factory method. |
protected void |
assertNotDisposed() Throws IllegalStateException if this factory has been disposed via invocation of dispose() . |
protected static void |
checkPermission(NamedCache cache) Check if the current user is allowed to "join" the cache. |
protected void |
configure() Performs final configuration of an ExtensibleConfigurableCacheFactory instance prior to it being used by Coherence. |
void |
destroyCache(NamedCache cache) Release and destroy this instance of NamedCache. |
void |
dispose() Dispose of this factory. |
NamedCache |
ensureCache(java.lang.String sCacheName, java.lang.ClassLoader loader) Ensure a cache for the given name. |
Service |
ensureService(ServiceScheme scheme) Ensure the service for the specified scheme then start the service if it isn't running. |
Service |
ensureService(java.lang.String sServiceName) Ensure a service for the given name. |
CacheConfig |
getCacheConfig() Return the CacheConfig that contains the configuration used by this factory. |
protected java.lang.ClassLoader |
getConfigClassLoader() Return the class loader used to load the configuration for this factory. |
InterceptorRegistry |
getInterceptorRegistry() Return the InterceptorRegistry for this factory. |
com.tangosol.config.expression.ParameterResolver |
getParameterResolver(java.lang.String sCacheName, java.lang.ClassLoader loader, BackingMapManagerContext context) Return the ParameterResolver that has been initialized with the built-in Coherence parameters. |
protected long |
getRequestTimeout(ServiceScheme scheme) Return the request timeout determined by the ServiceScheme . |
ResourceRegistry |
getResourceRegistry() Return the ResourceRegistry for this factory. |
java.lang.String |
getScopeName() Return the scope name for this ConfigurableCacheFactory. |
protected boolean |
isDisposed() Return true if this factory has been disposed via invocation of dispose() . |
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. |
protected 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 java.lang.String |
resolveScopeName(ServiceBuilder bldrService) Determine the scope name for the given ServiceBuilder . |
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. |
protected void |
startService(Service service) Start the given Service . |
java.util.Map |
startServices() Start all services that are declared as requiring an "autostart". |
protected int |
translateSchemeType(java.lang.String sScheme) Translate the scheme name into the scheme type. |
protected static int |
translateStandardSchemeType(java.lang.String sScheme) Translate the scheme name into the scheme type. |
protected void |
validateBackingMapManager(CacheService service) Ensures that the backing map manager of the specified service was configured by this (or equivalent) factory. |
Field Detail |
---|
public static final java.lang.String FILE_CFG_CACHE
public static final java.lang.String CACHE_NAME
public static final java.lang.String CLASS_LOADER
public static final java.lang.String MGR_CONTEXT
public static final java.lang.String SCHEME_REF
public static final java.lang.String CACHE_REF
public static final int SCHEME_UNKNOWN
public static final int SCHEME_REPLICATED
public static final int SCHEME_OPTIMISTIC
public static final int SCHEME_DISTRIBUTED
public static final int SCHEME_NEAR
public static final int SCHEME_VERSIONED_NEAR
public static final int SCHEME_LOCAL
public static final int SCHEME_OVERFLOW
public static final int SCHEME_DISK
SCHEME_EXTERNAL
and SCHEME_EXTERNAL_PAGED
public static final int SCHEME_EXTERNAL
public static final int SCHEME_EXTERNAL_PAGED
public static final int SCHEME_CLASS
public static final int SCHEME_READ_WRITE_BACKING
public static final int SCHEME_VERSIONED_BACKING
public static final int SCHEME_INVOCATION
public static final int SCHEME_PROXY
public static final int SCHEME_REMOTE_CACHE
public static final int SCHEME_REMOTE_INVOCATION
public static final int SCHEME_TRANSACTIONAL
public static final int SCHEME_FLASHJOURNAL
public static final int SCHEME_RAMJOURNAL
public static final java.util.HashMap MAP_SCHEMETYPE_BY_SCHEMENAME
protected final com.tangosol.net.internal.ScopedReferenceStore f_store
protected final com.tangosol.net.events.internal.ConfigurableCacheFactoryDispatcher f_dispatcher
protected java.util.Set m_setServices
protected ScopeResolver m_scopeResolver
ScopeResolver
used for modifying the scope name in the cache configuration.protected java.util.Set m_setManager
Note: we rely on the BackingMapManager classes *not* to override the hashCode() and equals() methods.
protected boolean m_fActivated
protected boolean m_fDisposed
Constructor Detail |
---|
public ExtensibleConfigurableCacheFactory(ExtensibleConfigurableCacheFactory.Dependencies dependencies)
ExtensibleConfigurableCacheFactory
using the specified ExtensibleConfigurableCacheFactory.Dependencies
.
dependencies
- the ExtensibleConfigurableCacheFactory.Dependencies
Method Detail |
---|
public NamedCache ensureCache(java.lang.String sCacheName, java.lang.ClassLoader loader)
ensureCache
in interface ConfigurableCacheFactory
sCacheName
- the cache nameloader
- ClassLoader that should be used to deserialize objects in the cachepublic void releaseCache(NamedCache cache)
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.
releaseCache
in interface ConfigurableCacheFactory
cache
- the cache to releasepublic void destroyCache(NamedCache cache)
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.
destroyCache
in interface ConfigurableCacheFactory
cache
- the cache to releasepublic Service ensureService(java.lang.String sServiceName)
ensureService
in interface ConfigurableCacheFactory
sServiceName
- the service namepublic void activate()
activate
in interface ConfigurableCacheFactory
public void dispose()
ConfigurableCacheFactory.getResourceRegistry()
. This factory may not be used after invoking dispose.dispose
in interface ConfigurableCacheFactory
public ResourceRegistry getResourceRegistry()
ResourceRegistry
for this factory.getResourceRegistry
in interface ConfigurableCacheFactory
public InterceptorRegistry getInterceptorRegistry()
InterceptorRegistry
for this factory. EventInterceptor
s registered with this registry will be scoped to services and caches created by this factory.getInterceptorRegistry
in interface ConfigurableCacheFactory
InterceptorRegistry
for this factorypublic void setScopeName(java.lang.String sScopeName)
CacheFactoryBuilder
when initializing this ConfigurableCacheFactory instance.
This method will be removed in a future release.
sScopeName
- the scope name for this ConfigurableCacheFactoryjava.lang.IllegalStateException
- if this setter is invoked after a service startpublic java.lang.String getScopeName()
protected long getRequestTimeout(ServiceScheme scheme)
ServiceScheme
.scheme
- the scheme that determines the request timeoutprotected boolean isDisposed()
dispose()
.protected void assertNotDisposed()
IllegalStateException
if this factory has been disposed via invocation of dispose()
.java.lang.IllegalStateException
- if this factory has been disposedprotected void configure()
ExtensibleConfigurableCacheFactory
instance prior to it being used by Coherence.
This method is called by the ExtensibleConfigurableCacheFactory
constructor, just after the internal state has been initialized and before the ExtensibleConfigurableCacheFactory
instance is returned to the caller.
This method allows those that need to sub-class an ExtensibleConfigurableCacheFactory
to override the final stages of configuration. Anyone overriding this method must be sure to call super.configure() in order to ensure correction configuration semantics.
public Service ensureService(ServiceScheme scheme)
scheme
- the scheme needed to ensure the service.public CacheConfig getCacheConfig()
CacheConfig
that contains the configuration used by this factory.protected int translateSchemeType(java.lang.String sScheme)
sScheme
- the scheme nameprotected static int translateStandardSchemeType(java.lang.String sScheme)
sScheme
- the scheme namepublic java.util.Map startServices()
Map
of Service
s by service name that were successfully startedprotected void startService(Service service)
Service
. Extensions of this class can override this method to provide pre/post start functionality.service
- the Service
to startprotected void setConfigClassLoader(java.lang.ClassLoader loader)
loader
- the class loader to use for loading the configurationprotected java.lang.ClassLoader getConfigClassLoader()
protected static void checkPermission(NamedCache cache)
cache
- the cachejava.lang.SecurityException
- if permission is deniedpublic com.tangosol.config.expression.ParameterResolver getParameterResolver(java.lang.String sCacheName, java.lang.ClassLoader loader, BackingMapManagerContext context)
sCacheName
- the cache nameloader
- the ClassLoadercontext
- the BackingMapManagerContextprotected java.lang.String resolveScopeName(ServiceBuilder bldrService)
ServiceBuilder
.
Note: If the ServiceBuilder
does not have a scope name defined, then the scope name configured for this ConfigurableCacheFactory
will be used.
bldrService
- the ServiceBuilder
ServiceBuilder
protected void registerBackingMapManager(BackingMapManager mgr)
mgr
- a BackingMapManager instance instantiated by this factoryprotected void validateBackingMapManager(CacheService service) throws java.lang.IllegalStateException
service
- the CacheService to validatejava.lang.IllegalStateException
- if the backing map for the provided service does not reference the expected factoryprotected void release(java.util.Map map, java.util.Map mapListeners)
map
- the map being releasedmapListeners
- map of registered map listeners keyed by the corresponding map referencesprotected void release(CacheLoader loader)
loader
- the cache loader being releasedprotected void release(BinaryStore store)
store
- the binary store being releasedprotected void releaseCache(NamedCache cache, boolean fDestroy)
cache
- the cache to releasefDestroy
- true to destroy the cache as well
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |