|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CacheService
A CacheService is a clustered service providing a collection of named Maps that hold resources shared among members of a cluster. These resources are expected to be managed in memory, and are typically composed of data that are also stored persistently in a database, or data that have been assembled or calculated at some significant cost, thus these resources are referred to as cached.
Nested Class Summary | |
---|---|
static interface |
CacheService.CacheAction CacheAction represents a type of action taken by a CacheService. |
Field Summary | |
---|---|
static String |
TYPE_DISTRIBUTED DistributedCache service type constant. |
static String |
TYPE_LOCAL LocalCache service type constant. |
static String |
TYPE_OPTIMISTIC OptimisticCache service type constant. |
static String |
TYPE_REMOTE RemoteCache service type constant. |
static String |
TYPE_REPLICATED ReplicatedCache service type constant. |
Method Summary | |
---|---|
void |
destroyCache(NamedCache map) Release and destroy the specified cache. |
NamedCache |
ensureCache(String sName, ClassLoader loader) Obtain a NamedCache interface that provides a view of resources shared among members of a cluster. |
BackingMapManager |
getBackingMapManager() Return a backing map manager used by this CacheService. |
Enumeration |
getCacheNames() Returns an Enumeration of String objects, one for each cache name that has been previously registered with this CacheService. |
void |
releaseCache(NamedCache map) Release local resources associated with the specified instance of the cache. |
void |
setBackingMapManager(BackingMapManager manager) Set a backing map manager to be used by this CacheService to create underlying stores for the cached data. |
Methods inherited from interface com.tangosol.net.Service |
---|
addMemberListener, getCluster, getInfo, getSerializer, getUserContext, removeMemberListener, setUserContext |
Methods inherited from interface com.tangosol.util.Service |
---|
addServiceListener, removeServiceListener |
Methods inherited from interface com.tangosol.util.Controllable |
---|
configure, isRunning, shutdown, start, stop |
Methods inherited from interface com.tangosol.io.ClassLoaderAware |
---|
getContextClassLoader, setContextClassLoader |
Field Detail |
---|
static final String TYPE_REPLICATED
ReplicatedCache service provides the means for handling a collection of resources replicated across a cluster with concurrent access control.
Cluster.ensureService(String, String)
, Constant Field Valuesstatic final String TYPE_OPTIMISTIC
OptimisticCache service is an implementation similar to the ReplicatedCache, but without any concurrency control and the highest possible throughput.
Cluster.ensureService(String, String)
, Constant Field Valuesstatic final String TYPE_DISTRIBUTED
DistributedCache service provides the means for handling a collection of resources distributed across a cluster with concurrent access control.
Cluster.ensureService(String, String)
, Constant Field Valuesstatic final String TYPE_LOCAL
LocalCache service provides the means for handling a collection of resources limited to a single JVM with concurrent access control.
Cluster.ensureService(String, String)
, Constant Field Valuesstatic final String TYPE_REMOTE
Cluster.ensureService(String, String)
, Constant Field ValuesMethod Detail |
---|
BackingMapManager getBackingMapManager()
setBackingMapManager(BackingMapManager)
void setBackingMapManager(BackingMapManager manager)
manager
- a backing map managerIllegalStateException
- thrown if the service is already runningCacheFactory.getDistributedCacheService(String, BackingMapManager)
, CacheFactory.getOptimisticCacheService(String, BackingMapManager)
NamedCache ensureCache(String sName, ClassLoader loader)
sName
- the name, within this CacheService, that uniquely identifies a view; null is legal, and may imply a default nameloader
- ClassLoader that should be used to deserialize objects inserted in the map by other members of the cluster; null is legal, and implies the default ClassLoader, which will typically be the context ClassLoader for this serviceIllegalStateException
- thrown if the service is not runningCacheFactory.getDistributedCacheService(String)
, CacheFactory.getOptimisticCacheService(String)
, CacheFactory.getReplicatedCacheService(String)
Enumeration getCacheNames()
IllegalStateException
- thrown if the CacheService is not running or has stoppedvoid releaseCache(NamedCache map)
ensureCache(String, ClassLoader)
method.
Releasing a Map reference to a cache makes the Map reference 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.
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.
map
- the cache object to be releasedNamedCache.release()
void destroyCache(NamedCache map)
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.
map
- the cache object to be releasedNamedCache.destroy()
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |