Class PartitionedCache<K,V>
java.lang.Object
com.tangosol.coherence.jcache.AbstractCoherenceBasedCache<K,V,PartitionedCacheConfiguration<K,V>>
com.tangosol.coherence.jcache.partitionedcache.PartitionedCache<K,V>
- Type Parameters:
K
- key typeV
- value type
- All Implemented Interfaces:
CoherenceBasedCache<K,
,V> Closeable
,AutoCloseable
,Iterable<javax.cache.Cache.Entry<K,
,V>> javax.cache.Cache<K,
V>
public class PartitionedCache<K,V>
extends AbstractCoherenceBasedCache<K,V,PartitionedCacheConfiguration<K,V>>
JCache of Key, Value pairs implemented over distributed cache.
- Since:
- Coherence 12.1.3
- Author:
- jf 2013.07.07
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
JCache Entry iteratorNested classes/interfaces inherited from interface javax.cache.Cache
javax.cache.Cache.Entry<K,
V> -
Field Summary
Fields inherited from class com.tangosol.coherence.jcache.AbstractCoherenceBasedCache
m_configuration, m_manager, m_namedCache, m_sJCacheName
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
ConstructorDescriptionPartitionedCache
(CoherenceBasedCacheManager manager, String sJCacheName, PartitionedCacheConfiguration<K, V> configuration) Constructs aPartitionedCache
configured byPartitionedCacheConfiguration
in context ofCoherenceBasedCacheManager
with JCache namesJCacheName
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(K key) void
deregisterCacheEntryListener
(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> config) void
destroy()
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
.static void
Destroy a partitioned cache when there is no PartitionedCache object.static void
destroyCache
(CoherenceBasedCacheManager mgr, JCacheIdentifier id, NamedCache namedCache) Destroy a partitioned cache.getAndRemove
(K key) getAndReplace
(K key, V value) protected ClassLoader
get class loader for this CacheReturn currentJCacheContext
Obtain the internal identifier used for JCache caches.javax.cache.management.CacheMXBean
getMBean()
Get JMX Management Bean.protected CopyOnWriteArraySet
<CoherenceCacheEntryListenerRegistration<K, V>> get asynchronous CacheEntryListenerRegistrationsprotected CopyOnWriteArraySet
<CoherenceCacheEntryListenerRegistration<K, V>> get synchronous CacheEntryListenerRegistrationsGet JCache statistics<T> T
invokeAll
(Set<? extends K> setKey, javax.cache.processor.EntryProcessor<K, V, T> proc, Object... arguments) boolean
Get JCache Statistics statusiterator()
void
loadAll
(Set<? extends K> setKey, boolean fReplaceExistingValues, javax.cache.integration.CompletionListener listener) void
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.void
void
void
boolean
putIfAbsent
(K key, V value) void
registerCacheEntryListener
(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> config) boolean
boolean
void
void
boolean
boolean
void
setManagementEnabled
(boolean fEnabled) Sets management enablementvoid
setStatisticsEnabled
(boolean fEnabled) Sets m_statsprotected void
Requests aFutureTask
to be performed.toString()
Methods inherited from class com.tangosol.coherence.jcache.AbstractCoherenceBasedCache
close, ensureOpen, getCacheManager, getConfiguration, getName, isClosed, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PartitionedCache
public PartitionedCache(CoherenceBasedCacheManager manager, String sJCacheName, PartitionedCacheConfiguration<K, V> configuration) Constructs aPartitionedCache
configured byPartitionedCacheConfiguration
in context ofCoherenceBasedCacheManager
with JCache namesJCacheName
.- Parameters:
manager
- CacheManager manages the created PartitionedCache.sJCacheName
- JCache cache name that must be unique withinCoherenceBasedCacheManager
contextconfiguration
- JCache cache configuration
-
-
Method Details
-
getIdentifier
Description copied from interface:CoherenceBasedCache
Obtain the internal identifier used for JCache caches.- Specified by:
getIdentifier
in interfaceCoherenceBasedCache<K,
V> - Specified by:
getIdentifier
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Returns:
- the internal
JCacheIdentifier
-
destroy
public void destroy()Description copied from interface:CoherenceBasedCache
Destroys aCoherenceBasedCache
due to a request from aCoherenceBasedCacheManager
. -
get
-
getAll
-
containsKey
-
loadAll
-
put
-
getAndPut
-
putAll
-
putAll
public void putAll(Map<? extends K, ? extends V> map, boolean fReplaceExistingValues, boolean fUseWriteThrough) - Parameters:
map
- mapfReplaceExistingValues
- if false, do not update existing valuesfUseWriteThrough
- is writer-through enabled
-
putIfAbsent
-
remove
-
remove
-
getAndRemove
-
replace
-
replace
-
getAndReplace
-
removeAll
-
removeAll
public void removeAll() -
clear
public void clear() -
invoke
-
invokeAll
-
registerCacheEntryListener
-
deregisterCacheEntryListener
-
iterator
-
getMBean
public javax.cache.management.CacheMXBean getMBean()Get JMX Management Bean.- Specified by:
getMBean
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Returns:
- JMX Management bean
-
getStatistics
Get JCache statistics- Specified by:
getStatistics
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Returns:
- JCache statistics when enabled, return null when not enabled.
-
onBeforeClosing
public void onBeforeClosing()Description copied from class:AbstractCoherenceBasedCache
Closes aCoherenceBasedCache
at the request of a call toCache.close()
.- Specified by:
onBeforeClosing
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>>
-
isStatisticsEnabled
public boolean isStatisticsEnabled()Description copied from class:AbstractCoherenceBasedCache
Get JCache Statistics status- Specified by:
isStatisticsEnabled
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Returns:
- true if enabled, otherwise false
-
getClassLoader
get class loader for this Cache- Overrides:
getClassLoader
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Returns:
- a classloader
-
submit
Requests aFutureTask
to be performed.- Parameters:
task
- theFutureTask
to be performed
-
getRegisteredSynchronousEventListeners
protected CopyOnWriteArraySet<CoherenceCacheEntryListenerRegistration<K,V>> getRegisteredSynchronousEventListeners()get synchronous CacheEntryListenerRegistrations- Returns:
- a thread-safe set of CacheEntryListenerRegistrations that are all synchronous listeners.
-
getRegisteredAsynchronousEventListeners
protected CopyOnWriteArraySet<CoherenceCacheEntryListenerRegistration<K,V>> getRegisteredAsynchronousEventListeners()get asynchronous CacheEntryListenerRegistrations- Returns:
- a thread-safe set of CacheEntryListenerRegistrations that are all asynchronous listeners.
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean fEnabled) Sets m_stats- Specified by:
setStatisticsEnabled
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Parameters:
fEnabled
- true to enable
-
setManagementEnabled
public void setManagementEnabled(boolean fEnabled) Sets management enablement- Specified by:
setManagementEnabled
in classAbstractCoherenceBasedCache<K,
V, PartitionedCacheConfiguration<K, V>> - Parameters:
fEnabled
- true if management should be fEnabled
-
getContext
Return currentJCacheContext
- Returns:
JCacheContext
-
destroyCache
public static void destroyCache(CoherenceBasedCacheManager mgr, JCacheIdentifier id, NamedCache namedCache) Destroy a partitioned cache.- Parameters:
mgr
-CoherenceBasedCacheManager
id
- PartitionedCache external cache namenamedCache
- CoherenceNamedCache
-
destroyCache
Destroy a partitioned cache when there is no PartitionedCache object. This method removes leftover context such as mapping from JCache name to configuration and destroys outstanding NamedCache. Handles scenario where cache is created and closed in one jvm and discovered not destroyed in another jvm.- Parameters:
mgr
-CoherenceBasedCacheManager
id
- PartitionedCache external cache name
-
toString
-