Interface CachingProvider
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface CachingProvider extends Closeable
Provides mechanisms to create, request and later manage the life-cycle of configuredCacheManager
s, identified byURI
s and scoped byClassLoader
s.The meaning and semantics of the
URI
used to identify aCacheManager
is implementation dependent. For applications to remain implementation independent, they should avoid attempting to createURI
s and instead use those returned bygetDefaultURI()
.- Since:
- 1.0
- Author:
- Brian Oliver, Greg Luck
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes all of theCacheManager
instances and associated resources created and maintained by theCachingProvider
across allClassLoader
s.void
close(ClassLoader classLoader)
Closes allCacheManager
instances and associated resources created by theCachingProvider
using the specifiedClassLoader
.void
close(URI uri, ClassLoader classLoader)
Closes allCacheManager
instances and associated resources created by theCachingProvider
for the specifiedURI
andClassLoader
.CacheManager
getCacheManager()
Requests aCacheManager
configured according to thegetDefaultURI()
andgetDefaultProperties()
be made available that using thegetDefaultClassLoader()
for loading underlying classes.CacheManager
getCacheManager(URI uri, ClassLoader classLoader)
Requests aCacheManager
configured according to the implementation specificURI
that uses the providedClassLoader
for loading underlying classes.CacheManager
getCacheManager(URI uri, ClassLoader classLoader, Properties properties)
Requests aCacheManager
configured according to the implementation specificURI
be made available that uses the providedClassLoader
for loading underlying classes.ClassLoader
getDefaultClassLoader()
Obtains the defaultClassLoader
that will be used by theCachingProvider
.Properties
getDefaultProperties()
Obtains the defaultProperties
for theCachingProvider
.URI
getDefaultURI()
Obtains the defaultURI
for theCachingProvider
.boolean
isSupported(OptionalFeature optionalFeature)
Determines whether an optional feature is supported by theCachingProvider
.
-
-
-
Method Detail
-
getCacheManager
CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties)
Requests aCacheManager
configured according to the implementation specificURI
be made available that uses the providedClassLoader
for loading underlying classes.Multiple calls to this method with the same
URI
andClassLoader
must return the sameCacheManager
instance, except if a previously returnedCacheManager
has been closed.Properties are used in construction of a
CacheManager
and do not form part of the identity of the CacheManager. i.e. if a second call is made to with the sameURI
andClassLoader
but different properties, theCacheManager
created in the first call is returned.Properties names follow the same scheme as package names. The prefixes
java
andjavax
are reserved. Properties are passed through and can be retrieved viaCacheManager.getProperties()
. Properties within the package scope of a caching implementation may be used for additional configuration.- Parameters:
uri
- an implementation specific URI for theCacheManager
(null means usegetDefaultURI()
)classLoader
- theClassLoader
to use for theCacheManager
(null means usegetDefaultClassLoader()
)properties
- theProperties
for theCachingProvider
to create theCacheManager
(null means no implementation specific Properties are required)- Throws:
CacheException
- when aCacheManager
for the specified arguments could not be producedSecurityException
- when the operation could not be performed due to the current security settings
-
getDefaultClassLoader
ClassLoader getDefaultClassLoader()
Obtains the defaultClassLoader
that will be used by theCachingProvider
.- Returns:
- the default
ClassLoader
used by theCachingProvider
-
getDefaultURI
URI getDefaultURI()
Obtains the defaultURI
for theCachingProvider
.Use this method to obtain a suitable
URI
for theCachingProvider
.- Returns:
- the default
URI
for theCachingProvider
-
getDefaultProperties
Properties getDefaultProperties()
Obtains the defaultProperties
for theCachingProvider
.Use this method to obtain suitable
Properties
for theCachingProvider
.- Returns:
- the default
Properties
for theCachingProvider
-
getCacheManager
CacheManager getCacheManager(URI uri, ClassLoader classLoader)
Requests aCacheManager
configured according to the implementation specificURI
that uses the providedClassLoader
for loading underlying classes.Multiple calls to this method with the same
URI
andClassLoader
must return the sameCacheManager
instance, except if a previously returnedCacheManager
has been closed.- Parameters:
uri
- an implementation specificURI
for theCacheManager
(null means usegetDefaultURI()
)classLoader
- theClassLoader
to use for theCacheManager
(null means usegetDefaultClassLoader()
)- Throws:
CacheException
- when aCacheManager
for the specified arguments could not be producedSecurityException
- when the operation could not be performed due to the current security settings
-
getCacheManager
CacheManager getCacheManager()
Requests aCacheManager
configured according to thegetDefaultURI()
andgetDefaultProperties()
be made available that using thegetDefaultClassLoader()
for loading underlying classes.Multiple calls to this method must return the same
CacheManager
instance, except if a previously returnedCacheManager
has been closed.- Throws:
SecurityException
- when the operation could not be performed due to the current security settings
-
close
void close()
Closes all of theCacheManager
instances and associated resources created and maintained by theCachingProvider
across allClassLoader
s.After closing the
CachingProvider
will still be operational. It may still be used for acquiringCacheManager
instances, though those will now be new.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
SecurityException
- when the operation could not be performed due to the current security settings
-
close
void close(ClassLoader classLoader)
Closes allCacheManager
instances and associated resources created by theCachingProvider
using the specifiedClassLoader
.After closing the
CachingProvider
will still be operational. It may still be used for acquiringCacheManager
instances, though those will now be new for the specifiedClassLoader
.- Parameters:
classLoader
- theClassLoader
to release- Throws:
SecurityException
- when the operation could not be performed due to the current security settings
-
close
void close(URI uri, ClassLoader classLoader)
Closes allCacheManager
instances and associated resources created by theCachingProvider
for the specifiedURI
andClassLoader
.- Parameters:
uri
- theURI
to releaseclassLoader
- theClassLoader
to release- Throws:
SecurityException
- when the operation could not be performed due to the current security settings
-
isSupported
boolean isSupported(OptionalFeature optionalFeature)
Determines whether an optional feature is supported by theCachingProvider
.- Parameters:
optionalFeature
- the feature to check for- Returns:
- true if the feature is supported
-
-