Package com.tangosol.coherence.jcache
Class CoherenceBasedCacheManager
- java.lang.Object
-
- com.tangosol.coherence.jcache.CoherenceBasedCacheManager
-
- All Implemented Interfaces:
Disposable
,Closeable
,AutoCloseable
,javax.cache.CacheManager
public class CoherenceBasedCacheManager extends Object implements javax.cache.CacheManager, Disposable
The Coherence-based implementation of aCacheManager
.- Author:
- jf 2013.06.18, bo 2013.12.17
-
-
Constructor Summary
Constructors Constructor Description CoherenceBasedCacheManager(CoherenceBasedCachingProvider provider, ConfigurableCacheFactory ccf, URI uri, ClassLoader classLoader, Properties properties)
Constructs a newCoherenceBasedCacheManager
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Default implementation invokesDisposable.dispose()
, it is not recommended that this be overridden.<K,V,C extends javax.cache.configuration.Configuration<K,V>>
javax.cache.Cache<K,V>createCache(String sJCacheName, C cfgJCache)
void
destroyCache(String sName)
void
dispose()
Invoked when all resources owned by the implementer can safely be released.void
enableManagement(String sName, boolean fEnabled)
void
enableStatistics(String sName, boolean fEnabled)
javax.cache.Cache
getCache(String sJCacheName)
<K,V>
javax.cache.Cache<K,V>getCache(String sJCacheName, Class<K> clzKey, Class<V> clzType)
Iterable<String>
getCacheNames()
CoherenceBasedCompleteConfiguration
getCacheToConfigurationMapping(JCacheIdentifier cacheId)
Provide access to meta cache that maps JCache cache names to JCache configuration.javax.cache.spi.CachingProvider
getCachingProvider()
ClassLoader
getClassLoader()
ConfigurableCacheFactory
getConfigurableCacheFactory()
Get ConfigurableCacheFactory context.Properties
getProperties()
URI
getURI()
boolean
isClosed()
void
putCacheToConfigurationMapping(JCacheIdentifier cacheId, CoherenceBasedCompleteConfiguration config)
put entry with key of sNamevoid
releaseCache(String sName)
release cache namedsName
void
removeCacheToConfigurationMapping(JCacheIdentifier cacheId)
remove entry with key of sNameString
toString()
<T> T
unwrap(Class<T> clz)
boolean
validate()
Validate if configurations map is valid with this instance.
-
-
-
Constructor Detail
-
CoherenceBasedCacheManager
public CoherenceBasedCacheManager(CoherenceBasedCachingProvider provider, ConfigurableCacheFactory ccf, URI uri, ClassLoader classLoader, Properties properties)
Constructs a newCoherenceBasedCacheManager
.- Parameters:
provider
- theCachingProvider
that owns theCacheManager
ccf
- theConfigurableCacheFactory
to use forCoherenceBasedCache
suri
- theURI
of theCacheManager
(this must point to a valid Coherence Cache configuration file)classLoader
- theClassLoader
to use for loadingCache
resources, including keys, values, loaders, writers etcproperties
- the custom configurationProperties
-
-
Method Detail
-
getCacheToConfigurationMapping
public CoherenceBasedCompleteConfiguration getCacheToConfigurationMapping(JCacheIdentifier cacheId)
Provide access to meta cache that maps JCache cache names to JCache configuration. The mapping is a string to a JCache Configuration object.- Parameters:
cacheId
- JCache unique identifier- Returns:
- a named cache that maps JCache cache names to JCache configurations.
-
putCacheToConfigurationMapping
public void putCacheToConfigurationMapping(JCacheIdentifier cacheId, CoherenceBasedCompleteConfiguration config)
put entry with key of sName- Parameters:
cacheId
- key of entry to put into _metaJCacheNameToConfig
-
removeCacheToConfigurationMapping
public void removeCacheToConfigurationMapping(JCacheIdentifier cacheId)
remove entry with key of sName- Parameters:
cacheId
- key of entry to remove from _metaJCacheNameToConfig
-
getCachingProvider
public javax.cache.spi.CachingProvider getCachingProvider()
- Specified by:
getCachingProvider
in interfacejavax.cache.CacheManager
-
getURI
public URI getURI()
- Specified by:
getURI
in interfacejavax.cache.CacheManager
-
getProperties
public Properties getProperties()
- Specified by:
getProperties
in interfacejavax.cache.CacheManager
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoader
in interfacejavax.cache.CacheManager
-
createCache
public <K,V,C extends javax.cache.configuration.Configuration<K,V>> javax.cache.Cache<K,V> createCache(String sJCacheName, C cfgJCache) throws IllegalArgumentException
- Specified by:
createCache
in interfacejavax.cache.CacheManager
- Throws:
IllegalArgumentException
-
getCache
public <K,V> javax.cache.Cache<K,V> getCache(String sJCacheName, Class<K> clzKey, Class<V> clzType)
- Specified by:
getCache
in interfacejavax.cache.CacheManager
-
getCache
public javax.cache.Cache getCache(String sJCacheName)
- Specified by:
getCache
in interfacejavax.cache.CacheManager
-
getCacheNames
public Iterable<String> getCacheNames()
- Specified by:
getCacheNames
in interfacejavax.cache.CacheManager
-
destroyCache
public void destroyCache(String sName)
- Specified by:
destroyCache
in interfacejavax.cache.CacheManager
-
enableStatistics
public void enableStatistics(String sName, boolean fEnabled)
- Specified by:
enableStatistics
in interfacejavax.cache.CacheManager
-
enableManagement
public void enableManagement(String sName, boolean fEnabled)
- Specified by:
enableManagement
in interfacejavax.cache.CacheManager
-
close
public void close()
Description copied from interface:Disposable
Default implementation invokesDisposable.dispose()
, it is not recommended that this be overridden.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.cache.CacheManager
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDisposable
-
dispose
public void dispose()
Description copied from interface:Disposable
Invoked when all resources owned by the implementer can safely be released.Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
- Specified by:
dispose
in interfaceDisposable
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfacejavax.cache.CacheManager
-
unwrap
public <T> T unwrap(Class<T> clz)
- Specified by:
unwrap
in interfacejavax.cache.CacheManager
-
getConfigurableCacheFactory
public ConfigurableCacheFactory getConfigurableCacheFactory()
Get ConfigurableCacheFactory context.- Returns:
ConfigurableCacheFactory
-
releaseCache
public void releaseCache(String sName)
release cache namedsName
- Parameters:
sName
- JCache Adapter map to release
-
validate
public boolean validate()
Validate if configurations map is valid with this instance.- Returns:
- true iff it is valid
-
-