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.Cache2kCoreProvider
PROVIDER
-
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 void
cacheClosed(org.cache2k.Cache<?,?> c)
Called from the cache during close()static void
checkName(String s)
Don't accept a cache or manager names with too weird characters.void
clear()
void
close()
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)
ClassLoader
getClassLoader()
Iterable<String>
getConfiguredCacheNames()
Object
getLockObject()
Used for JSR107 cache manager implementationString
getName()
Properties
getProperties()
Cache2kCoreProviderImpl
getProvider()
String
getVersion()
boolean
isClosed()
boolean
isDefaultManager()
String
newCache(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)
String
toString()
-
-
-
Constructor Detail
-
CacheManagerImpl
public CacheManagerImpl(Cache2kCoreProviderImpl provider, ClassLoader cl, String name, boolean defaultManager)
-
-
Method Detail
-
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:
isDefaultManager
in classorg.cache2k.CacheManager
-
getName
public String getName()
- Specified by:
getName
in classorg.cache2k.CacheManager
-
getActiveCaches
public Iterable<org.cache2k.Cache<?,?>> getActiveCaches()
- Specified by:
getActiveCaches
in classorg.cache2k.CacheManager
-
getConfiguredCacheNames
public Iterable<String> getConfiguredCacheNames()
- Specified by:
getConfiguredCacheNames
in classorg.cache2k.CacheManager
-
getCache
public <K,V> org.cache2k.Cache<K,V> getCache(String name)
- Specified by:
getCache
in classorg.cache2k.CacheManager
-
createCache
public <K,V> org.cache2k.Cache<K,V> createCache(org.cache2k.config.Cache2kConfig<K,V> cfg)
- Specified by:
createCache
in classorg.cache2k.CacheManager
-
clear
public void clear()
- Specified by:
clear
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in classorg.cache2k.CacheManager
-
getProperties
public Properties getProperties()
- Specified by:
getProperties
in classorg.cache2k.CacheManager
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoader
in classorg.cache2k.CacheManager
-
getVersion
public String getVersion()
-
getProvider
public Cache2kCoreProviderImpl getProvider()
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in classorg.cache2k.CacheManager
-
getLockObject
public Object getLockObject()
Used for JSR107 cache manager implementation
-
-