public abstract class AbstractHazelcastCacheManager extends Object implements javax.cache.CacheManager
CacheManager
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.
CacheManager
Modifier and Type | Field and Description |
---|---|
protected String |
cacheNamePrefix |
protected ConcurrentMap<String,ICache<?,?>> |
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,
URI uri,
ClassLoader classLoader,
Properties properties) |
Modifier and Type | Method and Description |
---|---|
protected abstract <K,V> void |
addCacheConfigIfAbsentToLocal(CacheConfig<K,V> cacheConfig) |
protected String |
cacheNamePrefix()
This method calculates a fixed string based on the URI and classloader using the formula:
|
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> ICache<K,V> |
createCacheProxy(CacheConfig<K,V> cacheConfig) |
protected abstract <K,V> CacheConfig<K,V> |
createConfigOnPartition(CacheConfig<K,V> cacheConfig) |
void |
destroy()
Destroy all managed caches.
|
void |
destroyCache(String cacheName) |
<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() |
protected String |
getCacheNameWithPrefix(String name) |
protected <K,V> ICache<?,?> |
getCacheUnchecked(String cacheName) |
javax.cache.spi.CachingProvider |
getCachingProvider() |
ClassLoader |
getClassLoader() |
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,ICache<?,?>> 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 javax.cache.spi.CachingProvider cachingProvider
protected HazelcastInstance hazelcastInstance
public AbstractHazelcastCacheManager(javax.cache.spi.CachingProvider cachingProvider, URI uri, ClassLoader classLoader, Properties properties)
public <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> 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
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
protected abstract void postClose()
public void destroy()
public boolean isClosed()
isClosed
in interface javax.cache.CacheManager
protected String cacheNamePrefix()
/hz[/uri][/classloader]/
URI and classloader are dropped if they have default values.
protected <K,V,C extends javax.cache.configuration.Configuration<K,V>> CacheConfig<K,V> createCacheConfig(String cacheName, C configuration)
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> void addCacheConfigIfAbsentToLocal(CacheConfig<K,V> cacheConfig)
protected abstract <K,V> ICache<K,V> createCacheProxy(CacheConfig<K,V> cacheConfig)
protected abstract <K,V> CacheConfig<K,V> getCacheConfigFromPartition(String cacheName, String simpleCacheName)
protected <K,V> void registerListeners(CacheConfig<K,V> cacheConfig, ICache<K,V> source)
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.