|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.cache.Caching
public final class Caching
A factory for creating CacheManagers using the SPI conventions in the JDK's ServiceLoader
META-INF/services/javax.cache.spi.CachingProvidercontaining the class name implementing
CachingProvider
e.g. For the reference implementation:
"javax.cache.implementation.RIServiceFactory"
Also keeps track of all CacheManagers created by the factory. Subsequent calls
to getCacheManager()
return the same CacheManager.
ServiceLoader
,
CachingProvider
Field Summary | |
---|---|
static String |
DEFAULT_CACHE_MANAGER_NAME
The name of the default cache manager. |
Method Summary | |
---|---|
static void |
close()
Reclaims all resources obtained from this factory. |
static boolean |
close(ClassLoader classLoader)
Reclaims all resources for a ClassLoader from this factory. |
static boolean |
close(ClassLoader classLoader,
String name)
Reclaims all resources for a ClassLoader from this factory. |
static CacheManager |
getCacheManager()
Get the default cache manager with the default classloader. |
static CacheManager |
getCacheManager(ClassLoader classLoader)
Get the default cache manager. |
static CacheManager |
getCacheManager(ClassLoader classLoader,
String name)
Get a named cache manager. |
static CacheManager |
getCacheManager(String name)
Get a named cache manager using the default cache loader as specified by the implementation. |
static CacheManagerFactory |
getCacheManagerFactory()
Get the singleton CacheManagerFactory |
static boolean |
isAnnotationsSupported()
Indicates whether annotations are supported |
static boolean |
isSupported(OptionalFeature optionalFeature)
Indicates whether a optional feature is supported by this implementation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CACHE_MANAGER_NAME
getCacheManager()
is invoked.
The default CacheManager is always created.
Method Detail |
---|
public static CacheManagerFactory getCacheManagerFactory()
public static CacheManager getCacheManager()
DEFAULT_CACHE_MANAGER_NAME
IllegalStateException
- if no CachingProvider was foundpublic static CacheManager getCacheManager(ClassLoader classLoader)
DEFAULT_CACHE_MANAGER_NAME
classLoader
- the ClassLoader that should be used in converting values into Java Objects. May be null.
IllegalStateException
- if no CachingProvider was foundpublic static CacheManager getCacheManager(String name)
name
- the name of the cache manager
NullPointerException
- if name is null
IllegalStateException
- if no CachingProvider was foundpublic static CacheManager getCacheManager(ClassLoader classLoader, String name)
CachingProvider
so that an implementation it to concrete implementations may use it to point to a specific configuration
used to configure the CacheManager. This allows CacheManagers to have different configurations. For example,
one CacheManager might be configured for standalone operation and another might be configured to participate
in a cluster.
Generally, It makes sense that a CacheManager is associated with a ClassLoader. I.e. all caches emanating
from the CacheManager, all code including key and value classes must be present in that ClassLoader.
Secondly, the Caching may be in a different ClassLoader than the
CacheManager (i.e. the Caching may be shared in an application server setting).
For this purpose a ClassLoader may be specified. If specified it will be used for all conversion between
values and Java Objects. While Java's in-built serialization may be used other schemes may also be used.
Either way the specified ClassLoader will be used.
The name parameter may be used to associate a configuration with this CacheManager instance.
classLoader
- the ClassLoader that should be used in converting values into Java Objects.name
- the name of this cache manager
NullPointerException
- if classLoader or name is null
IllegalStateException
- if no CachingProvider was foundpublic static void close() throws CachingShutdownException
CacheManager cacheManager = CacheFactory.getCacheManager(); assertSame(cacheManager, CacheFactory.getCacheManager()); CacheFactory.close(); assertNotSame(cacheManager, CacheFactory.getCacheManager());
CachingShutdownException
- if any of the individual shutdowns failedpublic static boolean close(ClassLoader classLoader) throws CachingShutdownException
classLoader
- the class loader for which managers will be shut down
CachingShutdownException
- if any of the individual shutdowns failedpublic static boolean close(ClassLoader classLoader, String name) throws CachingShutdownException
classLoader
- the class loader for which managers will be shut downname
- the name of the cache manager
CachingShutdownException
- if any of the individual shutdowns failedpublic static boolean isSupported(OptionalFeature optionalFeature)
optionalFeature
- the feature to check for
public static boolean isAnnotationsSupported()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |