Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net
Class CacheFactory

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.net.CacheFactory

    public abstract class CacheFactory

extends Base

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. There are various cache services and cache topologies that are supported by Coherence.

To get a cache reference use the `getCache(String, ClassLoader)` or `getCache(String)` methods.

This approach that has a lot of advantages over service type specific methods described further below because:

- complex cache topology could be configured declaratively in the cache configuration XML rather then programmaticaly via API;
- the caller's code could become completely generic and agnostic to the cache topology;
- the cache topology decision could be deferred and made much later in the development cycle without changing the application code.

In addition to the generic, configuration driven approach decribed above, it is possible to manage the cache service types explicitly. There are several different types of cache services available:

- DistributedCache

  DistributedCache service provides the means for handling a collection of resources distributed (partitioned) across a cluster with concurrent access control.
  The following factory methods return an instance of Distributed Cache service: `getDistributedCache()`, `getDistributedCache(String)`, `getDistributedCache(String, ClassLoader)`

- ReplicatedCache

  ReplicatedCache service provides the means for handling a collection of resources replicated across a cluster with concurrent access control based on the lease model. Each member of the cluster running the ReplicatedCache service holds a Map of resources that is replicated by all members of the cluster. The resources are Serializable (or Coherence "XML-izable") objects. In order for a member of the cluster to get a resource from the cache for a purpose of an update or addition of a resource to the cache, it must first obtain a lease for that resource. At any given time for every given resource there is a single member serving as an arbiter for that resource. This approach ensures the full synchronization of data across the entire cluster. Full failover support is also provided by ensuring that each cluster member has an up-to-date copy of the data and by automatically assigning a new arbiter for each resource that previously was arbited by a member that left the cluster.
  The following factory methods return an instance of Replicated Cache service: `getReplicatedCache()`, `getReplicatedCache(String)`, `getReplicatedCache(String, ClassLoader)`

- OptimisticCache

  OptimisticCache is a clustered cache implementation similar to the ReplicatedCache implementation, but without any concurrency control. This implementation has the highest possible throughput. It also allows to use an alternative underlying store for the cached data (for example, a MRU/MFU-based cache). However, if two cluster members are independently pruning or purging the underlying local stores, it is possible that a cluster member may have a different store content than that held by another cluster member.
  The following factory methods return an instance of Optimistic Cache service: `getOptimisticCache()`, `getOptimisticCache(String)`, `getOptimisticCache(String, ClassLoader)`

When a cache retrived by any of the above methods is no longer used, it is preferrable to call `releaseCache(NamedCache)` to release the associated resources. To destroy all instances of the cache across the cluster, use `destroyCache(NamedCache)`.

Other services:

- Invocation

  Invocation service provides the means for invoking and monitoring execution of classes on specified nodes across a cluster.
  The following factory method returns an instance of Invocation service: `getInvocationService(String)`

Author:
  cp 2001.12.14, gg

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 "configurablecache-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 NamedCache` | `getDistributedCache()` Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead
`static NamedCache` | `getDistributedCache(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getCache(String)` instead
`static NamedCache` | `getDistributedCache(java.lang.String sName, java.lang.ClassLoader loader)` Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead
`static XmlElement` | `getDistributedCacheConfig()` Return the default distributed cache configuration.
`static CacheService` | `getDistributedCacheService(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getService(String)` instead
`static CacheService` | `getDistributedCacheService(java.lang.String sName, BackingMapManager manager)` Deprecated. As of Coherence 3.3, deprecated with no replacement
`static InvocationService` | `getInvocationService(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getService(String)` instead
`static CacheService` | `getLocalCacheService(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getService(String)` instead
`static CacheService` | `getLocalCacheService(java.lang.String sName, BackingMapManager manager)` Deprecated. As of Coherence 3.3, deprecated with no replacement
`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 NamedCache` | `getOptimisticCache()` Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead
`static NamedCache` | `getOptimisticCache(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getCache(String)` instead
`static NamedCache` | `getOptimisticCache(java.lang.String sName, java.lang.ClassLoader loader)` Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead
`static CacheService` | `getOptimisticCacheService(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getService(String)` instead
`static CacheService` | `getOptimisticCacheService(java.lang.String sName, BackingMapManager manager)` Deprecated. As of Coherence 3.3, deprecated with no replacement
`static NamedCache` | `getReplicatedCache()` Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead
`static NamedCache` | `getReplicatedCache(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getCache(String)` instead
`static NamedCache` | `getReplicatedCache(java.lang.String sName, java.lang.ClassLoader loader)` Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead
`static XmlElement` | `getReplicatedCacheConfig()` Return the default replicated cache configuration.
`static CacheService` | `getReplicatedCacheService(java.lang.String sName)` Deprecated. As of Coherence 3.3, use `getService(String)` instead
`static CacheService` | `getReplicatedCacheService(java.lang.String sName, BackingMapManager manager)` Deprecated. As of Coherence 3.3, deprecated with no replacement
`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)` Specifify 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

### PRODUCT

    public static final java.lang.String PRODUCT

  The product name string.

### VERSION

    public static final java.lang.String VERSION

  Software version string.

Constructor Detail

### CacheFactory

    public CacheFactory()

Method Detail

### getReplicatedCache

    public static NamedCache getReplicatedCache()

  Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead

  Factory method returning an instance of the ReplicatedCache service exposed as a NamedCache interface.

  Returns:
    NamedCache interface of the ReplicatedCache service
  Since:
    Coherence 1.0

### getReplicatedCache

    public static NamedCache getReplicatedCache(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getCache(String)` instead

  Factory method returning an instance of the ReplicatedCache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster). If the NamedCache with the specified name already exists, a reference to the same object will be returned
  Returns:
    NamedCache interface of the ReplicatedCache service
  Since:
    Coherence 1.0

### getReplicatedCache

    public static NamedCache getReplicatedCache(java.lang.String sName,
                                                java.lang.ClassLoader loader)

  Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead

  Factory method returning an instance of the ReplicatedCache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster). If the NamedCache with the specified name already exists, a reference to the same object will be returned
    `loader` - ClassLoader that should be used to deserialize objects inserted in the map by other members of the cluster
  Returns:
    NamedCache interface of the ReplicatedCache service
  Since:
    Coherence 1.0

### getReplicatedCacheService

    public static CacheService getReplicatedCacheService(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getService(String)` instead

  Factory method returning an instance of the ReplicatedCache service.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
  Returns:
    an instance of running ReplicatedCache service
  Since:
    Coherence 1.1

### getReplicatedCacheService

    public static CacheService getReplicatedCacheService(java.lang.String sName,
                                                         BackingMapManager manager)

  Deprecated. As of Coherence 3.3, deprecated with no replacement

  Factory method returning an instance of the ReplicatedCache service. This factory method can be used to supply an alternative underlying store for the cached data.

  Note: If the underlying backing map can be modified by anything other than the ReplicatedCacheService itself (e.g. if the Map automatically expires its entries periodically or size-limits its contents), the service does not prevent any such modifications regardless of locks that are placed.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
    `manager` - a BackingMapManager that will be used to create underlying stores for the cached data. If not specified, `SafeHashMap` objects will be used for all local maps.
  Returns:
    an instance of running ReplicatedCache service
  Since:
    Coherence 2.2

### getOptimisticCache

    public static NamedCache getOptimisticCache()

  Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead

  Factory method returning an instance of the OptimisticCache service exposed as a NamedCache interface.

  Returns:
    NamedCache interface of the OptimisticCache service
  Since:
    Coherence 1.1

### getOptimisticCache

    public static NamedCache getOptimisticCache(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getCache(String)` instead

  Factory method returning an instance of the Optimistic cache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster). If the NamedCache with the specified name already exists, a reference to the same object will be returned
  Returns:
    NamedCache interface of the OptimisticCache service
  Since:
    Coherence 1.1

### getOptimisticCache

    public static NamedCache getOptimisticCache(java.lang.String sName,
                                                java.lang.ClassLoader loader)

  Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead

  Factory method returning an instance of the OptimisticCache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster). If the NamedCache with the specified name already exists, a reference to the same object will be returned
    `loader` - ClassLoader that should be used to deserialize objects inserted in the map by other members of the cluster
  Returns:
    NamedCache interface of the OptimisticCache service
  Since:
    Coherence 1.1

### getOptimisticCacheService

    public static CacheService getOptimisticCacheService(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getService(String)` instead

  Factory method returning an instance of the OptimisticCache service.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
  Returns:
    an instance of running OptimisticCache service
  Since:
    Coherence 1.1

### getOptimisticCacheService

    public static CacheService getOptimisticCacheService(java.lang.String sName,
                                                         BackingMapManager manager)

  Deprecated. As of Coherence 3.3, deprecated with no replacement

  Factory method returning an instance of the OptimisticCache service. This factory method can be used to supply an alternative underlying store for the cached data. For example, to use an MRU/MFU-based cache, the Coherence local `LocalCache` implementation can be used.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
    `manager` - a BackingMapManager that will be used to create underlying stores for the cached data. If not specified, `SafeHashMap` objects will be used for all local maps.
  Returns:
    an instance of running OptimisticCache service
  Since:
    Coherence 2.0

### getDistributedCache

    public static NamedCache getDistributedCache()

  Deprecated. As of Coherence 3.3, use `getService(String).ensureCache(null, null)` instead

  Factory method returning an instance of the DistributedCache service exposed as a NamedCache interface.

  Returns:
    NamedCache interface of the DistributedCache service
  Since:
    Coherence 1.2

### getDistributedCache

    public static NamedCache getDistributedCache(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getCache(String)` instead

  Factory method returning an instance of the DistributedCache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster); if the NamedCache with the specified name already exists, a reference to the same object will be returned
  Returns:
    NamedCache interface of the DistributedCache service
  Since:
    Coherence 1.2

### getDistributedCache

    public static NamedCache getDistributedCache(java.lang.String sName,
                                                 java.lang.ClassLoader loader)

  Deprecated. As of Coherence 3.3, use `getCache(String, ClassLoader)` instead

  Factory method returning an instance of the DistributedCache service exposed as a NamedCache interface.

  Parameters:
    `sName` - cache name (unique across the cluster); if the NamedCache with the specified name already exists, a reference to the same object will be returned
    `loader` - ClassLoader that should be used to deserialize objects inserted in the map by other members of the cluster
  Returns:
    NamedCache interface of the DistributedCache service
  Since:
    Coherence 1.2

### getDistributedCacheService

    public static CacheService getDistributedCacheService(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getService(String)` instead

  Factory method returning an instance of the DistributedCache service.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
  Returns:
    an instance of running DistributedCache service
  Since:
    Coherence 1.2

### getDistributedCacheService

    public static CacheService getDistributedCacheService(java.lang.String sName,
                                                          BackingMapManager manager)

  Deprecated. As of Coherence 3.3, deprecated with no replacement

  Factory method returning an instance of the DistributedCache service. This factory method can be used to supply an alternative underlying store for the cached data. For example, to use an MRU/MFU-based cache, the Coherence local `LocalCache` implementation can be used.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
    `manager` - a BackingMapManager that will be used to create underlying stores for the cached data. If not specified, `SafeHashMap` objects will be used for all local maps.
  Returns:
    an instance of running DistributedCache service
  Since:
    Coherence 2.0

### getLocalCacheService

    public static CacheService getLocalCacheService(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getService(String)` instead

  Factory method returning an instance of the LocalCache service.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
  Returns:
    an instance of running LocalCache service
  Since:
    Coherence 2.2

### getLocalCacheService

    public static CacheService getLocalCacheService(java.lang.String sName,
                                                    BackingMapManager manager)

  Deprecated. As of Coherence 3.3, deprecated with no replacement

  Factory method returning an instance of the LocalCache service. This factory method can be used to supply an alternative underlying store for the cached data. For example, to use an MRU/MFU-based cache, the Coherence local `LocalCache` implementation can be used.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
    `manager` - a BackingMapManager that will be used to create underlying stores for the cached data. If not specified, `SafeHashMap` objects will be used for all local maps.
  Returns:
    an instance of running LocalCache service
  Since:
    Coherence 2.2

### getCacheFactoryBuilder

    public static CacheFactoryBuilder getCacheFactoryBuilder()

  Obtain the CacheFactoryBuilder singleton using the configuration info from the "cache-factory-builder-config" element.

  Returns:
    an instance of CacheFactoryBuilder
  Since:
    Coherence 3.5.1

### setCacheFactoryBuilder

    public static void setCacheFactoryBuilder(CacheFactoryBuilder cfb)

  Specifify a singleton CacheFactoryBuilder.

  Parameters:
    `cfb` - an instance of CacheFactoryBuilder
  Since:
    Coherence 3.5.1

### getConfigurableCacheFactory

    public static ConfigurableCacheFactory getConfigurableCacheFactory()

  Obtain the ConfigurableCacheFactory singleton using the configuration info from the "configurablecache-factory-config" element located in the tangosol-coherence.xml configuration file.

  Returns:
    an instance of ConfigurableCacheFactory
  Since:
    Coherence 2.2

### getConfigurableCacheFactory

    public static ConfigurableCacheFactory getConfigurableCacheFactory(java.lang.ClassLoader loader)

  Obtain the ConfigurableCacheFactory associated with the specified class loader.

  Note: if `setConfigurableCacheFactory(com.tangosol.net.ConfigurableCacheFactory)` has been called, the same factory instance will be returned.

  Parameters:
    `loader` - the class loader for which to return a configurable cache factory
  Returns:
    the configurable cache factory for the specified loader

### setConfigurableCacheFactory

    public static void setConfigurableCacheFactory(ConfigurableCacheFactory factory)

  Specify a singleton of ConfigurableCacheFactory.

  Parameters:
    `factory` - an instance of ConfigurableCacheFactory
  Since:
    Coherence 2.2

### getService

    public static Service getService(java.lang.String sName)

  Return an instance of a service configured by the current ConfigurableCacheFactory. This helper method is a simple wrapper around the `ConfigurableCacheFactory.ensureService(String)` method.

  Parameters:
    `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 returned
  Returns:
    the Service object
  Since:
    Coherence 3.3

### getCache

    public static NamedCache getCache(java.lang.String sName)

  Return an instance of a cache configured by the current ConfigurableCacheFactory. This helper method is a simple wrapper around the `ConfigurableCacheFactory.ensureCache(String, ClassLoader)` method.

  Parameters:
    `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 returned
  Returns:
    the NamedCache object
  Since:
    Coherence 2.2

### getCache

    public static NamedCache getCache(java.lang.String sName,
                                      java.lang.ClassLoader loader)

  Return an instance of a cache configured by the current ConfigurableCacheFactory. This helper method is a simple wrapper around the `ConfigurableCacheFactory.ensureCache(String, ClassLoader)` method.

  Parameters:
    `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 returned
    `loader` - ClassLoader that should be used to deserialize objects inserted in the map by other members of the cluster
  Returns:
    the NamedCache object
  Since:
    Coherence 2.2

### getLocalTransaction

    public 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.

  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.

  Parameters:
    `map` - the NamedCache object to be used as a base for transaction
  Returns:
    a TransactionMap instance
  Since:
    Coherence 1.2

### commitTransactionCollection

    public static boolean commitTransactionCollection(java.util.Collection collCaches,
                                                      int cRetry)

  Commit the transaction represented by a collection of TransactionMap objects. Due to any of a number of reasons, the transaction could fail to commit; if it fails to commit, the transaction is rolled back.

  Parameters:
    `collCaches` - a collection of TransactionMap objects
    `cRetry` - the number of times [0..100] to retry a stage of the transaction if a concurrency conflict occurs
  Returns:
    true if the transaction could be committed; false otherwise

### rollbackTransactionCollection

    public static void rollbackTransactionCollection(java.util.Collection collCaches)

  Roll back the transaction represented by a collection of TransactionMap objects.

  Parameters:
    `collCaches` - a collection of TransactionMap objects

### getInvocationService

    public static InvocationService getInvocationService(java.lang.String sName)

  Deprecated. As of Coherence 3.3, use `getService(String)` instead

  Factory method returning an instance of the Invocation service.

  Parameters:
    `sName` - service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used
  Returns:
    an instance of running Invocation service
  Since:
    Coherence 2.1

### getCluster

    public static Cluster getCluster()

  Return a Cluster object for Coherence services.

  Returns:
    a Cluster object which may or may not be running
  Since:
    Coherence 1.1

### ensureCluster

    public static Cluster ensureCluster()

  Obtain a Cluster object running Coherence services. Calling this method is optional. The cluster member carrying caching services will be lazily intialized when a first cache is about to be created. However, that operation could take significant time (especially for a first cluster member). This method forces initialization, making all cache creating requests predictably faster.

  Returns:
    a Cluster object
  Since:
    Coherence 1.1

### shutdown

    public static void shutdown()

  Shutdown all clustered services.

  Since:
    Coherence 1.0

### releaseCache

    public static void releaseCache(NamedCache cache)

  Release local resources associated with the specified instance of the cache. This invalidates a reference obtained by using one of the factory methods (`getReplicatedCache, getOptimisticCache`).

  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.

  Parameters:
    `cache` - the NamedCache object to be released
  Since:
    Coherence 1.1
  See Also:
    `CacheService.releaseCache(NamedCache)`, `destroyCache(NamedCache)`

### destroyCache

    public static void destroyCache(NamedCache cache)

  Releases and destroys the specified 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 resources will be released.

  Parameters:
    `cache` - the NamedCache object to be destroyed
  Since:
    Coherence 1.1
  See Also:
    `CacheService.destroyCache(NamedCache)`, `releaseCache(NamedCache)`

### log

    public 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.

  Parameters:
    `sMessage` - a message to log
    `nSeverity` - the severity of the logged message; 0=default, 1=error; 2=warning; 3=info; 4-9=debug
  Since:
    Coherence 2.0

### isLogEnabled

    public static boolean isLogEnabled(int nSeverity)

  Check if a message of the specified severity level will be logged using the Coherence logging facility.

  Parameters:
    `nSeverity` - the severity of a message
  Returns:
    true if a message with the specified severity level will be logged; false otherwise
  Since:
    Coherence 3.2
  See Also:
    `log(java.lang.String, int)`

### getClusterConfig

    public static XmlElement getClusterConfig()

  Return the default cluster configuration as defined by the "cluster-config" element in the tangosol-coherence.xml configuration file.

  Returns:
    XmlElement representing the default cluster configuration

### getReplicatedCacheConfig

    public static XmlElement getReplicatedCacheConfig()

  Return the default replicated cache configuration.

  Returns:
    XmlElement representing the replicated cache configuration
  See Also:
    `getServiceConfig(String)`

### getDistributedCacheConfig

    public static XmlElement getDistributedCacheConfig()

  Return the default distributed cache configuration.

  Returns:
    XmlElement representing the distributed cache configuration
  See Also:
    `getServiceConfig(String)`

### getLoggingConfig

    public 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.

  Returns:
    XmlElement representing the logging facility configuration
  Since:
    Coherence 2.2

### setLoggingConfig

    public static void setLoggingConfig(XmlElement xmlCfg)

  Set the configuration info for the logging facility. If the Logger daemon is already running, this call will also force its restart.

  Parameters:
    `xmlCfg` - an XmlElement representing the new logging configuration
  Since:
    Coherence 3.4.1

### getCacheFactoryBuilderConfig

    public 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.

  Returns:
    XmlElement representing the cache factory builder configuration
  Since:
    Coherence 3.5.1

### setCacheFactoryBuilderConfig

    public static void setCacheFactoryBuilderConfig(XmlElement xmlCfg)

  Set the cache factory builder configuration. If the Cluster service is already running, this call will not have any effect.

  Parameters:
    `xmlCfg` - an XmlElement representing the cache factory builder configuration
  Since:
    Coherence 3.5.1

### getConfigurableCacheFactoryConfig

    public 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.

  Returns:
    XmlElement representing the configurable cache factory configuration
  Since:
    Coherence 2.2

### setConfigurableCacheFactoryConfig

    public static void setConfigurableCacheFactoryConfig(XmlElement xmlCfg)

  Set the configurable cache factory configuration. If the Cluster service is already running, this call will not have any effect.

  Parameters:
    `xmlCfg` - an XmlElement representing the configurable cache factory configuration
  Since:
    Coherence 3.4.1

### getSecurityConfig

    public static XmlElement getSecurityConfig()

  Return the security framework configuration.

  Returns:
    XmlElement representing the security framework configuration
  Since:
    Coherence 2.5

### setSecurityConfig

    public static void setSecurityConfig(XmlElement xmlCfg)

  Set the security framework configuration. If the Cluster service is already running, this call will not have any effect.

  Parameters:
    `xmlCfg` - an XmlElement representing the security framework configuration
  Since:
    Coherence 3.4.1

### getManagementConfig

    public static XmlElement getManagementConfig()

  Return the management framework configuration.

  Returns:
    XmlElement representing the management framework configuration
  Since:
    Coherence 3.3

### setManagementConfig

    public static void setManagementConfig(XmlElement xmlCfg)

  Set the management framework configuration. If the Cluster service is already running, this call will not have any effect.

  Parameters:
    `xmlCfg` - an XmlElement representing the management framework configuration
  Since:
    Coherence 3.4.1

### getServiceConfig

    public static XmlElement getServiceConfig(java.lang.String sServiceType)

  Return the configuration for the specified service type.

  Parameters:
    `sServiceType` - the service type
  Returns:
    XmlElement representing the service configuration
  Since:
    Coherence 2.2

### setServiceConfig

    public static void setServiceConfig(java.lang.String sServiceType,
                                        XmlElement xmlCfg)

  Set the configuration for the specified service type. If the Cluster service is already running, this call may not have any effect.

  Parameters:
    `sServiceType` - the service type
    `xmlCfg` - an XmlElement representing the service configuration
  Since:
    Coherence 3.4.1

### main

    public static void main(java.lang.String[] asArg)
                     throws java.lang.Exception

  Invoke the Coherence command line tool.

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.