Package com.tangosol.coherence.jcache
Class AbstractCoherenceBasedCache<K,V,C extends CoherenceBasedConfiguration<K,V>>
- java.lang.Object
-
- com.tangosol.coherence.jcache.AbstractCoherenceBasedCache<K,V,C>
-
- Type Parameters:
K- the type of theCachekeysV- the type of theCachevaluesC- the type of theCacheconfiguration
- All Implemented Interfaces:
CoherenceBasedCache<K,V>,Closeable,AutoCloseable,Iterable<javax.cache.Cache.Entry<K,V>>,javax.cache.Cache<K,V>
- Direct Known Subclasses:
LocalCache,PartitionedCache,PassThroughCache,RemoteCache
public abstract class AbstractCoherenceBasedCache<K,V,C extends CoherenceBasedConfiguration<K,V>> extends Object implements CoherenceBasedCache<K,V>
The base implementation of aCoherenceBasedCache.- Since:
- Coherence 12.1.3
- Author:
- bo 2013.11.04
-
-
Field Summary
Fields Modifier and Type Field Description protected Cm_configurationTheConfigurationfor theCoherenceBasedCache.protected CoherenceBasedCacheManagerm_managerTheCoherenceBasedCacheManagerthat owns theCache.protected NamedCachem_namedCacheThe underlyingNamedCachethat holds then entries for theCoherenceBasedCache.protected Stringm_sJCacheNameTheCachename of theCoherenceBasedCache.-
Fields inherited from interface com.tangosol.coherence.jcache.CoherenceBasedCache
JCACHE_CONFIG_BACK_SCHEME_NAME, JCACHE_CONFIG_BACK_SCHEME_SERVICE_NAME, JCACHE_CONFIG_CACHE_NAME, JCACHE_CONFIG_SCHEME_NAME, JCACHE_CONFIG_SERVICE_NAME, JCACHE_EXTEND_PROXY_SERVICE_NAME, JCACHE_EXTEND_SCHEME_NAME, JCACHE_EXTEND_SERVICE_NAME, JCACHE_LOCAL_CACHE_NAME_PATTERN, JCACHE_LOCAL_CACHE_NAME_PREFIX, JCACHE_LOCAL_SCHEME_NAME, JCACHE_LOCAL_SERVICE_NAME, JCACHE_PARTITIONED_CACHE_NAME_PATTERN, JCACHE_PARTITIONED_CACHE_NAME_PREFIX, JCACHE_PARTITIONED_SCHEME_NAME, JCACHE_PARTITIONED_SERVICE_NAME, JCACHE_REMOTE_SCHEME
-
-
Constructor Summary
Constructors Constructor Description AbstractCoherenceBasedCache(CoherenceBasedCacheManager manager, String sJCacheName, C configuration)Constructs anAbstractCoherenceBasedCache.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidensureOpen()Ensures that theCoherenceBasedCacheis open (not closed).javax.cache.CacheManagergetCacheManager()protected ClassLoadergetClassLoader()Determine theClassLoaderto use for theCoherenceBasedCache.<T extends javax.cache.configuration.Configuration<K,V>>
TgetConfiguration(Class<T> clz)abstract JCacheIdentifiergetIdentifier()Obtain the internal identifier used for JCache caches.abstract javax.cache.management.CacheMXBeangetMBean()Get JMX Bean associated with Cache.StringgetName()abstract JCacheStatisticsgetStatistics()Get JCache Statistics associated with Cache.booleanisClosed()abstract booleanisStatisticsEnabled()Get JCache Statistics statusabstract voidonBeforeClosing()Closes aCoherenceBasedCacheat the request of a call toCache.close().abstract voidsetManagementEnabled(boolean fEnabled)Set JCache Management status.abstract voidsetStatisticsEnabled(boolean fEnabled)Set JCache statistics status<T> Tunwrap(Class<T> clz)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.cache.Cache
clear, containsKey, deregisterCacheEntryListener, get, getAll, getAndPut, getAndRemove, getAndReplace, invoke, invokeAll, iterator, loadAll, put, putAll, putIfAbsent, registerCacheEntryListener, remove, remove, removeAll, removeAll, replace, replace
-
Methods inherited from interface com.tangosol.coherence.jcache.CoherenceBasedCache
destroy
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
m_manager
protected CoherenceBasedCacheManager m_manager
TheCoherenceBasedCacheManagerthat owns theCache.
-
m_sJCacheName
protected String m_sJCacheName
TheCachename of theCoherenceBasedCache.
-
m_namedCache
protected NamedCache m_namedCache
The underlyingNamedCachethat holds then entries for theCoherenceBasedCache.
-
m_configuration
protected C extends CoherenceBasedConfiguration<K,V> m_configuration
TheConfigurationfor theCoherenceBasedCache.
-
-
Constructor Detail
-
AbstractCoherenceBasedCache
public AbstractCoherenceBasedCache(CoherenceBasedCacheManager manager, String sJCacheName, C configuration)
Constructs anAbstractCoherenceBasedCache.- Parameters:
manager- theCoherenceBasedCacheManagerthat owns theCoherenceBasedCachesJCacheName- the name of theCacheconfiguration- theCoherenceBasedConfigurationfor theCache
-
-
Method Detail
-
close
public void close()
-
getConfiguration
public <T extends javax.cache.configuration.Configuration<K,V>> T getConfiguration(Class<T> clz)
-
getCacheManager
public javax.cache.CacheManager getCacheManager()
-
ensureOpen
protected void ensureOpen() throws IllegalStateExceptionEnsures that theCoherenceBasedCacheis open (not closed).- Throws:
IllegalStateException- if theCoherenceBasedCacheis closed
-
onBeforeClosing
public abstract void onBeforeClosing()
Closes aCoherenceBasedCacheat the request of a call toCache.close().
-
getClassLoader
protected ClassLoader getClassLoader()
Determine theClassLoaderto use for theCoherenceBasedCache.- Returns:
- the
ClassLoader
-
getMBean
public abstract javax.cache.management.CacheMXBean getMBean()
Get JMX Bean associated with Cache.- Returns:
- JMX Bean
-
getStatistics
public abstract JCacheStatistics getStatistics()
Get JCache Statistics associated with Cache.- Returns:
- JCache Statistics if exist or null.
-
setManagementEnabled
public abstract void setManagementEnabled(boolean fEnabled)
Set JCache Management status.- Parameters:
fEnabled- true to enable
-
setStatisticsEnabled
public abstract void setStatisticsEnabled(boolean fEnabled)
Set JCache statistics status- Parameters:
fEnabled- true to enable
-
isStatisticsEnabled
public abstract boolean isStatisticsEnabled()
Get JCache Statistics status- Returns:
- true if enabled, otherwise false
-
getIdentifier
public abstract JCacheIdentifier getIdentifier()
Description copied from interface:CoherenceBasedCacheObtain the internal identifier used for JCache caches.- Specified by:
getIdentifierin interfaceCoherenceBasedCache<K,V>- Returns:
- the internal
JCacheIdentifier
-
-