public abstract class AbstractHazelcastCacheManager extends Object implements HazelcastCacheManager
HazelcastCacheManager
(also CacheManager
as indirect) implementation
provides shared functionality to server and client cache managers.
There are two cache managers which can be accessed via their providers.
AbstractHazelcastCacheManager
manages the lifecycle of the caches created or accessed through itself.
HazelcastCacheManager
,
CacheManager
Modifier and Type | Field and Description |
---|---|
protected String |
cacheNamePrefix |
protected ConcurrentMap<String,ICacheInternal<?,?>> |
caches |
protected javax.cache.spi.CachingProvider |
cachingProvider |
protected WeakReference<ClassLoader> |
classLoaderReference |
protected HazelcastInstance |
hazelcastInstance |
protected boolean |
isDefaultClassLoader |
protected boolean |
isDefaultURI |
protected Properties |
properties |
protected URI |
uri |
Constructor and Description |
---|
AbstractHazelcastCacheManager(javax.cache.spi.CachingProvider cachingProvider,
HazelcastInstance hazelcastInstance,
URI uri,
ClassLoader classLoader,
Properties properties) |
Modifier and Type | Method and Description |
---|---|
protected abstract <K,V> void |
addCacheConfigIfAbsent(CacheConfig<K,V> cacheConfig) |
protected String |
cacheNamePrefix()
This method calculates a fixed string based on the URI and classloader using the formula:
|
protected void |
checkIfManagerNotClosed() |
void |
close() |
<K,V,C extends javax.cache.configuration.Configuration<K,V>> |
createCache(String cacheName,
C configuration) |
protected <K,V,C extends javax.cache.configuration.Configuration<K,V>> |
createCacheConfig(String cacheName,
C configuration) |
protected abstract <K,V> ICacheInternal<K,V> |
createCacheProxy(CacheConfig<K,V> cacheConfig) |
protected abstract <K,V> CacheConfig<K,V> |
createConfig(String cacheName,
CacheConfig<K,V> config,
boolean createAlsoOnOthers,
boolean syncCreate) |
protected abstract <K,V> CacheConfig<K,V> |
createConfigOnPartition(CacheConfig<K,V> cacheConfig) |
void |
destroy()
Destroy all managed caches.
|
void |
destroyCache(String cacheName) |
protected <K,V> ICacheInternal<K,V> |
ensureOpenIfAvailable(ICacheInternal<K,V> cache) |
protected abstract <K,V> CacheConfig<K,V> |
findConfig(String cacheName,
String simpleCacheName,
boolean createAlsoOnOthers,
boolean syncCreate) |
<K,V> ICache<K,V> |
getCache(String cacheName) |
<K,V> ICache<K,V> |
getCache(String cacheName,
Class<K> keyType,
Class<V> valueType) |
protected abstract <K,V> CacheConfig<K,V> |
getCacheConfigFromPartition(String cacheName,
String simpleCacheName) |
protected abstract <K,V> CacheConfig<K,V> |
getCacheConfigLocal(String cacheName) |
Iterable<String> |
getCacheNames() |
String |
getCacheNameWithPrefix(String name)
Gets cache name by adding manager prefix.
|
protected <K,V> ICacheInternal<?,?> |
getCacheUnchecked(String cacheName) |
javax.cache.spi.CachingProvider |
getCachingProvider() |
ClassLoader |
getClassLoader() |
HazelcastInstance |
getHazelcastInstance()
Gets the underlying
HazelcastInstance implementation. |
<K,V> ICache<K,V> |
getOrCreateCache(String cacheName,
CacheConfig<K,V> cacheConfig) |
Properties |
getProperties() |
URI |
getURI() |
boolean |
isClosed() |
protected abstract void |
postClose() |
protected <K,V> void |
registerListeners(CacheConfig<K,V> cacheConfig,
ICache<K,V> source) |
protected void |
removeCacheConfigFromLocal(String cacheName)
Removes the local copy of the cache configuration if one exists.
|
String |
toString() |
protected final ConcurrentMap<String,ICacheInternal<?,?>> caches
protected final URI uri
protected final WeakReference<ClassLoader> classLoaderReference
protected final Properties properties
protected final String cacheNamePrefix
protected final boolean isDefaultURI
protected final boolean isDefaultClassLoader
protected final javax.cache.spi.CachingProvider cachingProvider
protected final HazelcastInstance hazelcastInstance
public AbstractHazelcastCacheManager(javax.cache.spi.CachingProvider cachingProvider, HazelcastInstance hazelcastInstance, URI uri, ClassLoader classLoader, Properties properties)
public HazelcastInstance getHazelcastInstance()
HazelcastCacheManager
HazelcastInstance
implementation.getHazelcastInstance
in interface HazelcastCacheManager
HazelcastInstance
implementationpublic <K,V,C extends javax.cache.configuration.Configuration<K,V>> ICache<K,V> createCache(String cacheName, C configuration) throws IllegalArgumentException
createCache
in interface javax.cache.CacheManager
IllegalArgumentException
public javax.cache.spi.CachingProvider getCachingProvider()
getCachingProvider
in interface javax.cache.CacheManager
public URI getURI()
getURI
in interface javax.cache.CacheManager
public ClassLoader getClassLoader()
getClassLoader
in interface javax.cache.CacheManager
public Properties getProperties()
getProperties
in interface javax.cache.CacheManager
public <K,V> ICache<K,V> getCache(String cacheName, Class<K> keyType, Class<V> valueType)
getCache
in interface javax.cache.CacheManager
public <K,V> ICache<K,V> getOrCreateCache(String cacheName, CacheConfig<K,V> cacheConfig)
public <K,V> ICache<K,V> getCache(String cacheName)
getCache
in interface javax.cache.CacheManager
protected <K,V> ICacheInternal<K,V> ensureOpenIfAvailable(ICacheInternal<K,V> cache)
protected <K,V> ICacheInternal<?,?> getCacheUnchecked(String cacheName)
public Iterable<String> getCacheNames()
getCacheNames
in interface javax.cache.CacheManager
public void destroyCache(String cacheName)
destroyCache
in interface javax.cache.CacheManager
protected void removeCacheConfigFromLocal(String cacheName)
cacheName
- cache name.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface javax.cache.CacheManager
public void destroy()
destroy
in interface HazelcastCacheManager
public boolean isClosed()
isClosed
in interface javax.cache.CacheManager
protected void checkIfManagerNotClosed()
protected String cacheNamePrefix()
/hz[/uri][/classloader]/
URI and classloader are dropped if they have default values.
public String getCacheNameWithPrefix(String name)
HazelcastCacheManager
getCacheNameWithPrefix
in interface HazelcastCacheManager
name
- pure cache name with prefixprotected <K,V,C extends javax.cache.configuration.Configuration<K,V>> CacheConfig<K,V> createCacheConfig(String cacheName, C configuration)
protected <K,V> void registerListeners(CacheConfig<K,V> cacheConfig, ICache<K,V> source)
protected abstract <K,V> void addCacheConfigIfAbsent(CacheConfig<K,V> cacheConfig)
protected abstract <K,V> ICacheInternal<K,V> createCacheProxy(CacheConfig<K,V> cacheConfig)
protected abstract <K,V> CacheConfig<K,V> findConfig(String cacheName, String simpleCacheName, boolean createAlsoOnOthers, boolean syncCreate)
protected abstract <K,V> CacheConfig<K,V> createConfig(String cacheName, CacheConfig<K,V> config, boolean createAlsoOnOthers, boolean syncCreate)
protected abstract <K,V> CacheConfig<K,V> getCacheConfigLocal(String cacheName)
protected abstract <K,V> CacheConfig<K,V> createConfigOnPartition(CacheConfig<K,V> cacheConfig)
protected abstract <K,V> CacheConfig<K,V> getCacheConfigFromPartition(String cacheName, String simpleCacheName)
protected abstract void postClose()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.