Package org.cache2k.core
Class CacheManagerImpl
- java.lang.Object
-
- org.cache2k.CacheManager
-
- org.cache2k.core.CacheManagerImpl
-
- All Implemented Interfaces:
AutoCloseable
public class CacheManagerImpl extends org.cache2k.CacheManager- Author:
- Jens Wilke
-
-
Field Summary
Fields Modifier and Type Field Description static org.cache2k.spi.Cache2kCoreProviderPROVIDER
-
Constructor Summary
Constructors Constructor Description CacheManagerImpl(Cache2kCoreProviderImpl provider, ClassLoader cl, String name, boolean defaultManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheClosed(org.cache2k.Cache<?,?> c)Called from the cache during close()static voidcheckName(String s)Don't accept a cache or manager names with too weird characters.voidclear()voidclose()The shutdown takes place in two phases.<K,V>
org.cache2k.Cache<K,V>createCache(org.cache2k.config.Cache2kConfig<K,V> cfg)Iterable<org.cache2k.Cache>getActiveCaches()<K,V>
org.cache2k.Cache<K,V>getCache(String name)static Iterable<CacheLifeCycleListener>getCacheLifeCycleListeners()ClassLoadergetClassLoader()Iterable<String>getConfiguredCacheNames()ObjectgetLockObject()Used for JSR107 cache manager implementationStringgetName()PropertiesgetProperties()Cache2kCoreProviderImplgetProvider()StringgetVersion()booleanisClosed()booleanisDefaultManager()StringnewCache(org.cache2k.Cache<?,?> c, String requestedName)<K,V>
voidsendClosedEvent(org.cache2k.Cache<K,V> c, InternalCacheCloseContext ctx)<K,V>
voidsendCreatedEvent(org.cache2k.Cache c, InternalCacheBuildContext<K,V> ctx)StringtoString()
-
-
-
Constructor Detail
-
CacheManagerImpl
public CacheManagerImpl(Cache2kCoreProviderImpl provider, ClassLoader cl, String name, boolean defaultManager)
-
-
Method Detail
-
getCacheLifeCycleListeners
public static Iterable<CacheLifeCycleListener> getCacheLifeCycleListeners()
-
sendCreatedEvent
public <K,V> void sendCreatedEvent(org.cache2k.Cache c, InternalCacheBuildContext<K,V> ctx)
-
sendClosedEvent
public <K,V> void sendClosedEvent(org.cache2k.Cache<K,V> c, InternalCacheCloseContext ctx)
-
checkName
public static void checkName(String s)
Don't accept a cache or manager names with too weird characters.- See Also:
Cache2kBuilder.name(String)
-
newCache
public String newCache(org.cache2k.Cache<?,?> c, String requestedName)
- Throws:
IllegalStateException- if cache manager was closed or is closingIllegalStateException- if cache already created
-
cacheClosed
public void cacheClosed(org.cache2k.Cache<?,?> c)
Called from the cache during close()
-
isDefaultManager
public boolean isDefaultManager()
- Specified by:
isDefaultManagerin classorg.cache2k.CacheManager
-
getName
public String getName()
- Specified by:
getNamein classorg.cache2k.CacheManager
-
getActiveCaches
public Iterable<org.cache2k.Cache> getActiveCaches()
- Specified by:
getActiveCachesin classorg.cache2k.CacheManager
-
getConfiguredCacheNames
public Iterable<String> getConfiguredCacheNames()
- Specified by:
getConfiguredCacheNamesin classorg.cache2k.CacheManager
-
getCache
public <K,V> org.cache2k.Cache<K,V> getCache(String name)
- Specified by:
getCachein classorg.cache2k.CacheManager
-
createCache
public <K,V> org.cache2k.Cache<K,V> createCache(org.cache2k.config.Cache2kConfig<K,V> cfg)
- Specified by:
createCachein classorg.cache2k.CacheManager
-
clear
public void clear()
- Specified by:
clearin classorg.cache2k.CacheManager
-
close
public void close()
The shutdown takes place in two phases. First all caches are notified to cancel their scheduled timer jobs, after that the shutdown is done. Cancelling the timer jobs first is needed, because there may be cache stacking and a timer job of one cache may call an already closed cache.Rationale exception handling: Exceptions on shutdown just could silently ignored, because a shutdown is done any way. Exceptions could be happened long before in a parallel task, shutdown is the last point where this could be propagated to the application. Silently ignoring is bad anyway, because this will cause that serious problems keep undetected. The exception and error handling within the cache tries everything that exceptions will be routed through as early and directly as possible.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classorg.cache2k.CacheManager
-
getProperties
public Properties getProperties()
- Specified by:
getPropertiesin classorg.cache2k.CacheManager
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoaderin classorg.cache2k.CacheManager
-
getVersion
public String getVersion()
-
getProvider
public Cache2kCoreProviderImpl getProvider()
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin classorg.cache2k.CacheManager
-
getLockObject
public Object getLockObject()
Used for JSR107 cache manager implementation
-
-