Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net
Class WrapperCacheService

java.lang.Object
  extended by com.tangosol.net.WrapperService
      extended by com.tangosol.net.WrapperCacheService

All Implemented Interfaces:
ClassLoaderAware, CacheService, Controllable, Service

public class WrapperCacheService
extends WrapperService
implements CacheService

CacheService implementation that delegates to a wrapped CacheService instance.

Author:
jh 2010.03.17

Nested Class Summary

 

Nested classes/interfaces inherited from interface com.tangosol.net.CacheService
CacheService.CacheAction

 

Field Summary

 

Fields inherited from class com.tangosol.net.WrapperService
m_service

 

Fields inherited from interface com.tangosol.net.CacheService
TYPE_DISTRIBUTED, TYPE_LOCAL, TYPE_OPTIMISTIC, TYPE_REMOTE, TYPE_REPLICATED

 

Constructor Summary
WrapperCacheService(CacheService service)
          Create a new WrapperCacheService that delegates to the given CacheService instance.

 

Method Summary
 void destroyCache(NamedCache map)
          Release and destroy the specified cache.
 NamedCache ensureCache(java.lang.String sName, java.lang.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.
 java.util.Enumeration getCacheNames()
          Returns an Enumeration of String objects, one for each cache name that has been previously registered with this CacheService.
 CacheService getCacheService()
          Return the wrapped 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.
 java.lang.String toString()
          

 

Methods inherited from class com.tangosol.net.WrapperService
addMemberListener, addServiceListener, configure, getCluster, getContextClassLoader, getInfo, getSerializer, getService, getUserContext, isRunning, removeMemberListener, removeServiceListener, setContextClassLoader, setUserContext, shutdown, start, stop

 

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

 

Constructor Detail

WrapperCacheService

public WrapperCacheService(CacheService service)
Create a new WrapperCacheService that delegates to the given CacheService instance.
Parameters:
service - the CacheService to wrap

Method Detail

getBackingMapManager

public BackingMapManager getBackingMapManager()
Return a backing map manager used by this CacheService.
Specified by:
getBackingMapManager in interface CacheService
Returns:
a backing map manager
See Also:
CacheService.setBackingMapManager(BackingMapManager)

setBackingMapManager

public void setBackingMapManager(BackingMapManager manager)
Set a backing map manager to be used by this CacheService to create underlying stores for the cached data. Some cache services may choose to ignore this setting.
Specified by:
setBackingMapManager in interface CacheService
Parameters:
manager - a backing map manager
See Also:
CacheFactory#getDistributedCacheService(String, BackingMapManager), CacheFactory#getOptimisticCacheService(String, BackingMapManager)

ensureCache

public NamedCache ensureCache(java.lang.String sName,
                              java.lang.ClassLoader loader)
Obtain a NamedCache interface that provides a view of resources shared among members of a cluster. The view is identified by name within this CacheService. Typically, repeated calls to this method with the same view name and class loader instance will result in the same view reference being returned.
Specified by:
ensureCache in interface CacheService
Parameters:
sName - the name, within this CacheService, that uniquely identifies a view; null is legal, and may imply a default name
loader - 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 service
Returns:
a NamedCache interface which can be used to access the resources of the specified view
See Also:
CacheFactory#getDistributedCacheService(String), CacheFactory#getOptimisticCacheService(String), CacheFactory#getReplicatedCacheService(String)

getCacheNames

public java.util.Enumeration getCacheNames()
Returns an Enumeration of String objects, one for each cache name that has been previously registered with this CacheService.
Specified by:
getCacheNames in interface CacheService
Returns:
Enumeration of cache names

releaseCache

public void releaseCache(NamedCache map)
Release local resources associated with the specified instance of the cache. This invalidates a reference obtained by using the CacheService.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.

Specified by:
releaseCache in interface CacheService
Parameters:
map - the cache object to be released
See Also:
NamedCache.release()

destroyCache

public void destroyCache(NamedCache map)
Release and destroy the specified 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.

Specified by:
destroyCache in interface CacheService
Parameters:
map - the cache object to be released
See Also:
NamedCache.destroy()

toString

public java.lang.String toString()
Overrides:
toString in class WrapperService

getCacheService

public CacheService getCacheService()
Return the wrapped CacheService.
Returns:
the wrapped CacheService

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.