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 theCache
keysV
- the type of theCache
valuesC
- the type of theCache
configuration
- 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 C
m_configuration
TheConfiguration
for theCoherenceBasedCache
.protected CoherenceBasedCacheManager
m_manager
TheCoherenceBasedCacheManager
that owns theCache
.protected NamedCache
m_namedCache
The underlyingNamedCache
that holds then entries for theCoherenceBasedCache
.protected String
m_sJCacheName
TheCache
name 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 void
close()
protected void
ensureOpen()
Ensures that theCoherenceBasedCache
is open (not closed).javax.cache.CacheManager
getCacheManager()
protected ClassLoader
getClassLoader()
Determine theClassLoader
to use for theCoherenceBasedCache
.<T extends javax.cache.configuration.Configuration<K,V>>
TgetConfiguration(Class<T> clz)
abstract JCacheIdentifier
getIdentifier()
Obtain the internal identifier used for JCache caches.abstract javax.cache.management.CacheMXBean
getMBean()
Get JMX Bean associated with Cache.String
getName()
abstract JCacheStatistics
getStatistics()
Get JCache Statistics associated with Cache.boolean
isClosed()
abstract boolean
isStatisticsEnabled()
Get JCache Statistics statusabstract void
onBeforeClosing()
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.abstract void
setManagementEnabled(boolean fEnabled)
Set JCache Management status.abstract void
setStatisticsEnabled(boolean fEnabled)
Set JCache statistics status<T> T
unwrap(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
TheCoherenceBasedCacheManager
that owns theCache
.
-
m_sJCacheName
protected String m_sJCacheName
TheCache
name of theCoherenceBasedCache
.
-
m_namedCache
protected NamedCache m_namedCache
The underlyingNamedCache
that holds then entries for theCoherenceBasedCache
.
-
m_configuration
protected C extends CoherenceBasedConfiguration<K,V> m_configuration
TheConfiguration
for theCoherenceBasedCache
.
-
-
Constructor Detail
-
AbstractCoherenceBasedCache
public AbstractCoherenceBasedCache(CoherenceBasedCacheManager manager, String sJCacheName, C configuration)
Constructs anAbstractCoherenceBasedCache
.- Parameters:
manager
- theCoherenceBasedCacheManager
that owns theCoherenceBasedCache
sJCacheName
- the name of theCache
configuration
- theCoherenceBasedConfiguration
for 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 IllegalStateException
Ensures that theCoherenceBasedCache
is open (not closed).- Throws:
IllegalStateException
- if theCoherenceBasedCache
is closed
-
onBeforeClosing
public abstract void onBeforeClosing()
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.
-
getClassLoader
protected ClassLoader getClassLoader()
Determine theClassLoader
to 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:CoherenceBasedCache
Obtain the internal identifier used for JCache caches.- Specified by:
getIdentifier
in interfaceCoherenceBasedCache<K,V>
- Returns:
- the internal
JCacheIdentifier
-
-