Interface CachingProvider
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
public interface CachingProvider extends java.io.CloseableProvides mechanisms to create, request and later manage the life-cycle of configuredCacheManagers, identified byURIs and scoped byClassLoaders.The meaning and semantics of the
URIused to identify aCacheManageris implementation dependent. For applications to remain implementation independent, they should avoid attempting to createURIs and instead use those returned bygetDefaultURI().- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes all of theCacheManagerinstances and associated resources created and maintained by theCachingProvideracross allClassLoaders.voidclose(java.lang.ClassLoader classLoader)Closes allCacheManagerinstances and associated resources created by theCachingProviderusing the specifiedClassLoader.voidclose(java.net.URI uri, java.lang.ClassLoader classLoader)Closes allCacheManagerinstances and associated resources created by theCachingProviderfor the specifiedURIandClassLoader.CacheManagergetCacheManager()Requests aCacheManagerconfigured according to thegetDefaultURI()andgetDefaultProperties()be made available that using thegetDefaultClassLoader()for loading underlying classes.CacheManagergetCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader)Requests aCacheManagerconfigured according to the implementation specificURIthat uses the providedClassLoaderfor loading underlying classes.CacheManagergetCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader, java.util.Properties properties)Requests aCacheManagerconfigured according to the implementation specificURIbe made available that uses the providedClassLoaderfor loading underlying classes.java.lang.ClassLoadergetDefaultClassLoader()Obtains the defaultClassLoaderthat will be used by theCachingProvider.java.util.PropertiesgetDefaultProperties()Obtains the defaultPropertiesfor theCachingProvider.java.net.URIgetDefaultURI()Obtains the defaultURIfor theCachingProvider.booleanisSupported(OptionalFeature optionalFeature)Determines whether an optional feature is supported by theCachingProvider.
-
-
-
Method Detail
-
getCacheManager
CacheManager getCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader, java.util.Properties properties)
Requests aCacheManagerconfigured according to the implementation specificURIbe made available that uses the providedClassLoaderfor loading underlying classes.Multiple calls to this method with the same
URIandClassLoadermust return the sameCacheManagerinstance, except if a previously returnedCacheManagerhas been closed.Properties are used in construction of a
CacheManagerand do not form part of the identity of the CacheManager. i.e. if a second call is made to with the sameURIandClassLoaderbut different properties, theCacheManagercreated in the first call is returned.Properties names follow the same scheme as package names. The prefixes
javaandjavaxare 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- theClassLoaderto use for theCacheManager(null means usegetDefaultClassLoader())properties- thePropertiesfor theCachingProviderto create theCacheManager(null means no implementation specific Properties are required)- Throws:
CacheException- when aCacheManagerfor the specified arguments could not be producedjava.lang.SecurityException- when the operation could not be performed due to the current security settings
-
getDefaultClassLoader
java.lang.ClassLoader getDefaultClassLoader()
Obtains the defaultClassLoaderthat will be used by theCachingProvider.- Returns:
- the default
ClassLoaderused by theCachingProvider
-
getDefaultURI
java.net.URI getDefaultURI()
Obtains the defaultURIfor theCachingProvider.Use this method to obtain a suitable
URIfor theCachingProvider.- Returns:
- the default
URIfor theCachingProvider
-
getDefaultProperties
java.util.Properties getDefaultProperties()
Obtains the defaultPropertiesfor theCachingProvider.Use this method to obtain suitable
Propertiesfor theCachingProvider.- Returns:
- the default
Propertiesfor theCachingProvider
-
getCacheManager
CacheManager getCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader)
Requests aCacheManagerconfigured according to the implementation specificURIthat uses the providedClassLoaderfor loading underlying classes.Multiple calls to this method with the same
URIandClassLoadermust return the sameCacheManagerinstance, except if a previously returnedCacheManagerhas been closed.- Parameters:
uri- an implementation specificURIfor theCacheManager(null means usegetDefaultURI())classLoader- theClassLoaderto use for theCacheManager(null means usegetDefaultClassLoader())- Throws:
CacheException- when aCacheManagerfor the specified arguments could not be producedjava.lang.SecurityException- when the operation could not be performed due to the current security settings
-
getCacheManager
CacheManager getCacheManager()
Requests aCacheManagerconfigured according to thegetDefaultURI()andgetDefaultProperties()be made available that using thegetDefaultClassLoader()for loading underlying classes.Multiple calls to this method must return the same
CacheManagerinstance, except if a previously returnedCacheManagerhas been closed.- Throws:
java.lang.SecurityException- when the operation could not be performed due to the current security settings
-
close
void close()
Closes all of theCacheManagerinstances and associated resources created and maintained by theCachingProvideracross allClassLoaders.After closing the
CachingProviderwill still be operational. It may still be used for acquiringCacheManagerinstances, though those will now be new.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.lang.SecurityException- when the operation could not be performed due to the current security settings
-
close
void close(java.lang.ClassLoader classLoader)
Closes allCacheManagerinstances and associated resources created by theCachingProviderusing the specifiedClassLoader.After closing the
CachingProviderwill still be operational. It may still be used for acquiringCacheManagerinstances, though those will now be new for the specifiedClassLoader.- Parameters:
classLoader- theClassLoaderto release- Throws:
java.lang.SecurityException- when the operation could not be performed due to the current security settings
-
close
void close(java.net.URI uri, java.lang.ClassLoader classLoader)Closes allCacheManagerinstances and associated resources created by theCachingProviderfor the specifiedURIandClassLoader.- Parameters:
uri- theURIto releaseclassLoader- theClassLoaderto release- Throws:
java.lang.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
-
-