|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| 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_NAMEThe name of the replaceable parameter representing the cache name. |
static java.lang.String |
CACHE_REFThe name of the replaceable parameter representing a cache reference. |
static java.lang.String |
CLASS_LOADERThe name of the replaceable parameter representing the class loader. |
protected com.tangosol.net.events.internal.ConfigurableCacheFactoryDispatcher |
f_dispatcherConfigurableCacheFactoryDispatcher linked to this cache factory. |
protected com.tangosol.net.internal.ScopedReferenceStore |
f_storeStore that holds cache references scoped by class loader and optionally, if configured, Subject. |
static java.lang.String |
FILE_CFG_CACHEThe default configuration file name. |
protected boolean |
m_fActivatedIndicates whether this factory has been activated. |
protected boolean |
m_fDisposedIndicates whether this factory has been disposed. |
protected ScopeResolver |
m_scopeResolverThe ScopeResolver used for modifying the scope name in the cache configuration. |
protected java.util.Set |
m_setManagerA Set of BackingMapManager instances registered by this factory. |
protected java.util.Set |
m_setServicesSet used to hold references to services that are ensured by this factory. |
static java.util.HashMap |
MAP_SCHEMETYPE_BY_SCHEMENAMEThe mappings from scheme name to scheme type. |
static java.lang.String |
MGR_CONTEXTThe name of the replaceable parameter representing the backing map manager context. |
static int |
SCHEME_CLASSThe custom class scheme. |
static int |
SCHEME_DISKDeprecated. As of Coherence 3.0, replaced by SCHEME_EXTERNAL and SCHEME_EXTERNAL_PAGED |
static int |
SCHEME_DISTRIBUTEDThe distributed cache scheme. |
static int |
SCHEME_EXTERNALThe external scheme. |
static int |
SCHEME_EXTERNAL_PAGEDThe paged-external scheme. |
static int |
SCHEME_FLASHJOURNALThe flash journal cache scheme. |
static int |
SCHEME_INVOCATIONThe invocation service scheme. |
static int |
SCHEME_LOCALThe local cache scheme. |
static int |
SCHEME_NEARThe near cache scheme. |
static int |
SCHEME_OPTIMISTICThe optimistic cache scheme. |
static int |
SCHEME_OVERFLOWThe overflow map scheme. |
static int |
SCHEME_PROXYThe proxy service scheme. |
static int |
SCHEME_RAMJOURNALThe ram journal cache scheme. |
static int |
SCHEME_READ_WRITE_BACKINGThe read write backing map scheme. |
static java.lang.String |
SCHEME_REFThe name of the replaceable parameter representing a scheme reference. |
static int |
SCHEME_REMOTE_CACHEThe remote cache scheme. |
static int |
SCHEME_REMOTE_INVOCATIONThe remote invocation scheme. |
static int |
SCHEME_REPLICATEDThe replicated cache scheme. |
static int |
SCHEME_TRANSACTIONALThe transactional cache scheme. |
static int |
SCHEME_UNKNOWNThe unknown scheme type. |
static int |
SCHEME_VERSIONED_BACKINGThe versioned backing map scheme. |
static int |
SCHEME_VERSIONED_NEARThe 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 |
registerEventInterceptors(java.util.List listBuilders, ResolvableParameterList parameters)Register the NamedEventInterceptors generated by the provided builders with the InterceptorRegistry. |
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_PAGEDpublic 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 ConfigurableCacheFactorysCacheName - 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 ConfigurableCacheFactorycache - 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 ConfigurableCacheFactorycache - the cache to releasepublic Service ensureService(java.lang.String sServiceName)
ensureService in interface ConfigurableCacheFactorysServiceName - the service namepublic void activate()
activate in interface ConfigurableCacheFactorypublic void dispose()
ConfigurableCacheFactory.getResourceRegistry(). This factory may not be used after invoking dispose.dispose in interface ConfigurableCacheFactorypublic ResourceRegistry getResourceRegistry()
ResourceRegistry for this factory.getResourceRegistry in interface ConfigurableCacheFactorypublic InterceptorRegistry getInterceptorRegistry()
InterceptorRegistry for this factory. EventInterceptors registered with this registry will be scoped to services and caches created by this factory.getInterceptorRegistry in interface ConfigurableCacheFactoryInterceptorRegistry 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.
protected void registerEventInterceptors(java.util.List listBuilders,
ResolvableParameterList parameters)
NamedEventInterceptors generated by the provided builders with the InterceptorRegistry.listBuilders - the builders that generate NamedEventInterceptors to registerparameters - the parameters that can be consumed by the EventInterceptorspublic 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 Services 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 denied
public 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 ServiceBuilderServiceBuilderprotected void registerBackingMapManager(BackingMapManager mgr)
mgr - a BackingMapManager instance instantiated by this factory
protected 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 factory
protected 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 released
protected void releaseCache(NamedCache cache,
boolean fDestroy)
cache - the cache to releasefDestroy - true to destroy the cache as well
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||