|
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.CacheFactory
public abstract class CacheFactory
Factory for the Coherence™ cache product.
One of the most common functions provided by the CacheFactory is ability to obtain an instance of a cache. To get a cache reference use the getCache(String, ClassLoader)
or getCache(String)
methods.
When a cache retrieved by any of the above methods is no longer used, it is recommended to call releaseCache(NamedCache)
to release the associated resources. To destroy all instances of the cache across the cluster, use destroyCache(NamedCache)
.
Applications that require more control when obtaining cache and service references should use the CacheFactoryBuilder
API.
Field Summary | |
---|---|
static java.lang.String |
PRODUCT The product name string. |
static java.lang.String |
VERSION Software version string. |
Constructor Summary | |
---|---|
CacheFactory() |
Method Summary | |
---|---|
static boolean |
commitTransactionCollection(java.util.Collection collCaches, int cRetry) Commit the transaction represented by a collection of TransactionMap objects. |
static void |
destroyCache(NamedCache cache) Releases and destroys the specified NamedCache. |
static Cluster |
ensureCluster() Obtain a Cluster object running Coherence services. |
static NamedCache |
getCache(java.lang.String sName) Return an instance of a cache configured by the current ConfigurableCacheFactory. |
static NamedCache |
getCache(java.lang.String sName, java.lang.ClassLoader loader) Return an instance of a cache configured by the current ConfigurableCacheFactory. |
static CacheFactoryBuilder |
getCacheFactoryBuilder() Obtain the CacheFactoryBuilder singleton using the configuration info from the "cache-factory-builder-config" element. |
static XmlElement |
getCacheFactoryBuilderConfig() Return the cache factory builder configuration as defined by the "cache-factory-builder-config" element in the tangosol-coherence.xml configuration file. |
static Cluster |
getCluster() Return a Cluster object for Coherence services. |
static XmlElement |
getClusterConfig() Return the default cluster configuration as defined by the "cluster-config" element in the tangosol-coherence.xml configuration file. |
static ConfigurableCacheFactory |
getConfigurableCacheFactory() Obtain the ConfigurableCacheFactory singleton using the configuration info from the "configurable-cache-factory-config" element located in the tangosol-coherence.xml configuration file. |
static ConfigurableCacheFactory |
getConfigurableCacheFactory(java.lang.ClassLoader loader) Obtain the ConfigurableCacheFactory associated with the specified class loader. |
static XmlElement |
getConfigurableCacheFactoryConfig() Return the configurable cache factory configuration as defined by the "configurable-cache-factory-config" element in the tangosol-coherence.xml configuration file. |
static XmlElement |
getDistributedCacheConfig() Return the default distributed (partitioned) cache configuration. |
static java.lang.String |
getEdition() Returns the edition currently loaded based on the operational configuration. |
static TransactionMap |
getLocalTransaction(NamedCache map) Factory method returning an instance of the TransactionMap that is based on the specified NamedCache and is local to this JVM. |
static XmlElement |
getLoggingConfig() Return the configuration info for the logging facility as defined by the "logging-config" element in the tangosol-coherence.xml configuration file. |
static XmlElement |
getManagementConfig() Return the management framework configuration. |
static XmlElement |
getReplicatedCacheConfig() Return the default replicated cache configuration. |
static XmlElement |
getSecurityConfig() Return the security framework configuration. |
static Service |
getService(java.lang.String sName) Return an instance of a service configured by the current ConfigurableCacheFactory. |
static XmlElement |
getServiceConfig(java.lang.String sServiceType) Return the configuration for the specified service type. |
static boolean |
isLogEnabled(int nSeverity) Check if a message of the specified severity level will be logged using the Coherence logging facility. |
static void |
log(java.lang.String sMessage, int nSeverity) Log a message using Coherence logging facility which is driven by the "logging-config" element located in the tangosol-coherence.xml configuration file. |
static void |
main(java.lang.String[] asArg) Invoke the Coherence command line tool. |
static void |
releaseCache(NamedCache cache) Release local resources associated with the specified instance of the cache. |
static void |
rollbackTransactionCollection(java.util.Collection collCaches) Roll back the transaction represented by a collection of TransactionMap objects. |
static void |
setCacheFactoryBuilder(CacheFactoryBuilder cfb) Specify a singleton CacheFactoryBuilder. |
static void |
setCacheFactoryBuilderConfig(XmlElement xmlCfg) Set the cache factory builder configuration. |
static void |
setConfigurableCacheFactory(ConfigurableCacheFactory factory) Specify a singleton of ConfigurableCacheFactory. |
static void |
setConfigurableCacheFactoryConfig(XmlElement xmlCfg) Set the configurable cache factory configuration. |
static void |
setLoggingConfig(XmlElement xmlCfg) Set the configuration info for the logging facility. |
static void |
setManagementConfig(XmlElement xmlCfg) Set the management framework configuration. |
static void |
setSecurityConfig(XmlElement xmlCfg) Set the security framework configuration. |
static void |
setServiceConfig(java.lang.String sServiceType, XmlElement xmlCfg) Set the configuration for the specified service type. |
static void |
shutdown() Shutdown all clustered services. |
Field Detail |
---|
public static final java.lang.String PRODUCT
public static final java.lang.String VERSION
Constructor Detail |
---|
public CacheFactory()
Method Detail |
---|
public static CacheFactoryBuilder getCacheFactoryBuilder()
public static void setCacheFactoryBuilder(CacheFactoryBuilder cfb)
cfb
- an instance of CacheFactoryBuilderpublic static ConfigurableCacheFactory getConfigurableCacheFactory()
public static ConfigurableCacheFactory getConfigurableCacheFactory(java.lang.ClassLoader loader)
Note: if setConfigurableCacheFactory(com.tangosol.net.ConfigurableCacheFactory)
has been called, the same factory instance will be returned.
loader
- the class loader for which to return a configurable cache factorypublic static void setConfigurableCacheFactory(ConfigurableCacheFactory factory)
factory
- an instance of ConfigurableCacheFactorypublic static Service getService(java.lang.String sName)
ConfigurableCacheFactory.ensureService(String)
method.sName
- service name (unique for a given configurable cache factory). If the Service with the specified name already exists, a reference to the same object will be returnedpublic static NamedCache getCache(java.lang.String sName)
ConfigurableCacheFactory.ensureCache(String, ClassLoader)
method.sName
- cache name (unique for a given configurable cache factory). If the NamedCache with the specified name already exists, a reference to the same object will be returnedpublic static NamedCache getCache(java.lang.String sName, java.lang.ClassLoader loader)
ConfigurableCacheFactory.ensureCache(String, ClassLoader)
method.sName
- cache name (unique for a given configurable cache factory). If the NamedCache with the specified name already exists, a reference to the same object will be returnedloader
- ClassLoader that should be used to deserialize objects inserted in the map by other members of the clusterpublic static TransactionMap getLocalTransaction(NamedCache map)
Note: TransactionMap instance returned by this method will also implement the NamedCache interface, allowing a client code to chain local transaction by using the returned TransactionMap as a parameter for another getLocalTransaction()
call.
map
- the NamedCache object to be used as a base for transactionpublic static boolean commitTransactionCollection(java.util.Collection collCaches, int cRetry)
collCaches
- a collection of TransactionMap objectscRetry
- the number of times [0..100] to retry a stage of the transaction if a concurrency conflict occurspublic static void rollbackTransactionCollection(java.util.Collection collCaches)
collCaches
- a collection of TransactionMap objectspublic static Cluster getCluster()
public static Cluster ensureCluster()
public static void shutdown()
public static void releaseCache(NamedCache cache)
Releasing a NamedCache reference makes it no longer usable, but does not affect the content of the cache. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference.
The reference that is released using this method can no longer be used; any attempt to use the reference will result in an exception.
The purpose for releasing a cache reference is to allow the cache implementation to release the ClassLoader used to deserialize items in the cache. The cache implementation ensures that all references to that ClassLoader are released. This implies that objects in the cache that were loaded by that ClassLoader will be re-serialized to release their hold on that ClassLoader. The result is that the ClassLoader can be garbage-collected by Java in situations where the cache is operating in an application server and applications are dynamically loaded and unloaded.
cache
- the NamedCache object to be releasedCacheService.releaseCache(NamedCache)
, destroyCache(NamedCache)
public static 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 resources will be released.
cache
- the NamedCache object to be destroyedCacheService.destroyCache(NamedCache)
, releaseCache(NamedCache)
public static java.lang.String getEdition()
public static void log(java.lang.String sMessage, int nSeverity)
sMessage
- a message to lognSeverity
- the severity of the logged message; 0=default, 1=error; 2=warning; 3=info; 4-9=debugpublic static boolean isLogEnabled(int nSeverity)
nSeverity
- the severity of a messagelog(java.lang.String, int)
public static XmlElement getClusterConfig()
public static XmlElement getReplicatedCacheConfig()
getServiceConfig(String)
public static XmlElement getDistributedCacheConfig()
getServiceConfig(String)
public static XmlElement getLoggingConfig()
public static void setLoggingConfig(XmlElement xmlCfg)
xmlCfg
- an XmlElement representing the new logging configurationpublic static XmlElement getCacheFactoryBuilderConfig()
public static void setCacheFactoryBuilderConfig(XmlElement xmlCfg)
xmlCfg
- an XmlElement representing the cache factory builder configurationpublic static XmlElement getConfigurableCacheFactoryConfig()
public static void setConfigurableCacheFactoryConfig(XmlElement xmlCfg)
xmlCfg
- an XmlElement representing the configurable cache factory configurationpublic static XmlElement getSecurityConfig()
public static void setSecurityConfig(XmlElement xmlCfg)
xmlCfg
- an XmlElement representing the security framework configurationpublic static XmlElement getManagementConfig()
public static void setManagementConfig(XmlElement xmlCfg)
xmlCfg
- an XmlElement representing the management framework configurationpublic static XmlElement getServiceConfig(java.lang.String sServiceType)
sServiceType
- the service typepublic static void setServiceConfig(java.lang.String sServiceType, XmlElement xmlCfg)
sServiceType
- the service typexmlCfg
- an XmlElement representing the service configurationpublic static void main(java.lang.String[] asArg) throws java.lang.Exception
java.lang.Exception
|
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 |