public static class Caching.CachingProviderRegistry extends Object
CachingProvider
s scoped by
ClassLoader
.Constructor and Description |
---|
Caching.CachingProviderRegistry()
Constructs a CachingProviderManager.
|
Modifier and Type | Method and Description |
---|---|
CachingProvider |
getCachingProvider()
Obtains the only
CachingProvider defined by the
getDefaultClassLoader() . |
CachingProvider |
getCachingProvider(ClassLoader classLoader)
Obtains the only
CachingProvider defined by the specified
ClassLoader . |
CachingProvider |
getCachingProvider(String fullyQualifiedClassName)
Obtain the
CachingProvider that is implemented by the specified
fully qualified class name using the getDefaultClassLoader() . |
CachingProvider |
getCachingProvider(String fullyQualifiedClassName,
ClassLoader classLoader)
Obtain the
CachingProvider that is implemented by the specified
fully qualified class name using the provided ClassLoader . |
Iterable<CachingProvider> |
getCachingProviders()
Obtain the
CachingProvider s that are available via the
getDefaultClassLoader() . |
Iterable<CachingProvider> |
getCachingProviders(ClassLoader classLoader)
Obtain the
CachingProvider s that are available via the specified
ClassLoader . |
ClassLoader |
getDefaultClassLoader()
Obtains the
ClassLoader to use for API methods that don't
explicitly require a ClassLoader but internally require one. |
protected CachingProvider |
loadCachingProvider(String fullyQualifiedClassName,
ClassLoader classLoader)
Load and instantiate the
CachingProvider with the specified
fully qualified class name using the provided ClassLoader |
void |
setDefaultClassLoader(ClassLoader classLoader)
Set the
ClassLoader to use for API methods that don't explicitly
require a ClassLoader , but internally use one. |
public Caching.CachingProviderRegistry()
public ClassLoader getDefaultClassLoader()
ClassLoader
to use for API methods that don't
explicitly require a ClassLoader
but internally require one.
By default this is the Thread.getContextClassLoader()
.ClassLoader
public void setDefaultClassLoader(ClassLoader classLoader)
ClassLoader
to use for API methods that don't explicitly
require a ClassLoader
, but internally use one.classLoader
- the ClassLoader
or null
if the
calling Thread.getContextClassLoader()
should
be usedpublic CachingProvider getCachingProvider()
CachingProvider
defined by the
getDefaultClassLoader()
.
Should zero or more than one CachingProvider
s be available, a
CacheException is thrown.CachingProvider
CacheException
- should zero or more than one
CachingProvider
be available
or a CachingProvider
could not be loadedgetCachingProvider(ClassLoader)
,
getCachingProviders(ClassLoader)
public CachingProvider getCachingProvider(ClassLoader classLoader)
CachingProvider
defined by the specified
ClassLoader
.
Should zero or more than one CachingProvider
s be available, a
CacheException is thrown.classLoader
- the ClassLoader
to use for loading the
CachingProvider
CachingProvider
CacheException
- should zero or more than one
CachingProvider
be available
or a CachingProvider
could not be loadedgetCachingProviders(ClassLoader)
public Iterable<CachingProvider> getCachingProviders()
CachingProvider
s that are available via the
getDefaultClassLoader()
.
If a javax.cache.cachingprovider
system property is defined,
only that CachingProvider
specified by that property is returned.
Otherwise all CachingProvider
s that are available via a
ServiceLoader
for CachingProvider
s using the default
ClassLoader
(and those explicitly requested via
getCachingProvider(String)
) are returned.Iterable
of CachingProvider
s loaded by the
default ClassLoader
public Iterable<CachingProvider> getCachingProviders(ClassLoader classLoader)
CachingProvider
s that are available via the specified
ClassLoader
.
If a javax.cache.cachingprovider
system property is defined,
only that CachingProvider
specified by that property is returned.
Otherwise all CachingProvider
s that are available via a
ServiceLoader
for CachingProvider
s using the specified
ClassLoader
(and those explicitly requested via
getCachingProvider(String, ClassLoader)
) are returned.classLoader
- the ClassLoader
of the returned
CachingProvider
sIterable
of CachingProvider
s loaded by the
specified ClassLoader
public CachingProvider getCachingProvider(String fullyQualifiedClassName)
CachingProvider
that is implemented by the specified
fully qualified class name using the getDefaultClassLoader()
.
Should this CachingProvider
already be loaded it is simply
returned, otherwise an attempt will be made to load and instantiate the
specified class name (using a no-args constructor).fullyQualifiedClassName
- the fully qualified class name of the
CachingProvider
CachingProvider
CacheException
- when the CachingProvider
can't be createdprotected CachingProvider loadCachingProvider(String fullyQualifiedClassName, ClassLoader classLoader) throws CacheException
CachingProvider
with the specified
fully qualified class name using the provided ClassLoader
fullyQualifiedClassName
- the name of the CachingProvider
classclassLoader
- the ClassLoader
to useCachingProvider
instanceCacheException
- if the specified CachingProvider
could not be loaded
or the specified class is not a CachingProvider
public CachingProvider getCachingProvider(String fullyQualifiedClassName, ClassLoader classLoader)
CachingProvider
that is implemented by the specified
fully qualified class name using the provided ClassLoader
.
Should this CachingProvider
already be loaded it is returned,
otherwise an attempt will be made to load and instantiate the specified
class (using a no-args constructor).fullyQualifiedClassName
- the fully qualified class name of the
CachingProvider
classLoader
- the ClassLoader
to load the
CachingProvider
CachingProvider
CacheException
- when the CachingProvider
can't be createdCopyright © 2013. All Rights Reserved.