public abstract class AbstractHazelcastCacheManager extends Object implements HazelcastCacheManager
HazelcastCacheManager
(also indirect CacheManager
)
implementation to provide 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 ConcurrentMap<String,ICacheInternal<?,?>> |
caches |
protected javax.cache.spi.CachingProvider |
cachingProvider |
protected HazelcastInstance |
hazelcastInstance |
protected boolean |
isDefaultClassLoader |
protected boolean |
isDefaultURI |
protected Properties |
properties |
protected URI |
uri |
CACHE_MANAGER_PREFIX
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) |
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> void |
createCacheConfig(String cacheName,
CacheConfig<K,V> config) |
protected abstract <K,V> ICacheInternal<K,V> |
createCacheProxy(CacheConfig<K,V> cacheConfig) |
void |
destroy()
Destroys all managed caches.
|
void |
destroyCache(String cacheName) |
protected void |
ensureOpen() |
protected abstract <K,V> CacheConfig<K,V> |
findCacheConfig(String cacheName,
String simpleCacheName) |
<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> |
getCacheConfig(String cacheName,
String simpleCacheName) |
Iterable<String> |
getCacheNames() |
String |
getCacheNameWithPrefix(String name)
Gets the cache name by adding the manager prefix.
|
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 |
onShuttingDown() |
protected abstract void |
postClose() |
protected void |
postDestroy() |
void |
removeCache(String cacheName,
boolean destroy)
Removes the associated cache with the given cache name.
|
protected void |
removeCacheConfigFromLocal(String cacheNameWithPrefix)
Removes the local copy of the cache configuration if one exists.
|
String |
toString() |
protected abstract <K,V> void |
validateCacheConfig(CacheConfig<K,V> cacheConfig) |
protected final ConcurrentMap<String,ICacheInternal<?,?>> caches
protected final javax.cache.spi.CachingProvider cachingProvider
protected final HazelcastInstance hazelcastInstance
protected final boolean isDefaultURI
protected final boolean isDefaultClassLoader
protected final URI uri
protected final Properties properties
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
public Iterable<String> getCacheNames()
getCacheNames
in interface javax.cache.CacheManager
public void destroyCache(String cacheName)
destroyCache
in interface javax.cache.CacheManager
public void removeCache(String cacheName, boolean destroy)
HazelcastCacheManager
removeCache
in interface HazelcastCacheManager
cacheName
- pure cache name without prefixdestroy
- flag to specify whether the removed cache will be
destroyedprotected void removeCacheConfigFromLocal(String cacheNameWithPrefix)
The default implementation does not require it, but client implementation overrides this to track a local copy of the config.
cacheNameWithPrefix
- the cache namepublic void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface javax.cache.CacheManager
public void destroy()
destroy
in interface HazelcastCacheManager
protected void postDestroy()
public boolean isClosed()
isClosed
in interface javax.cache.CacheManager
protected void ensureOpen()
public String getCacheNameWithPrefix(String name)
HazelcastCacheManager
getCacheNameWithPrefix
in interface HazelcastCacheManager
name
- pure cache name without prefixprotected <K,V,C extends javax.cache.configuration.Configuration<K,V>> CacheConfig<K,V> createCacheConfig(String cacheName, C configuration)
protected abstract <K,V> void validateCacheConfig(CacheConfig<K,V> cacheConfig)
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> findCacheConfig(String cacheName, String simpleCacheName)
protected abstract <K,V> void createCacheConfig(String cacheName, CacheConfig<K,V> config)
protected abstract <K,V> CacheConfig<K,V> getCacheConfig(String cacheName, String simpleCacheName)
protected abstract void postClose()
protected abstract void onShuttingDown()
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.