Interface CachingProvider
- All Superinterfaces:
AutoCloseable, Closeable
CacheManagers, identified by URIs and scoped by
ClassLoaders.
The meaning and semantics of the URI used to identify a
CacheManager is implementation dependent. For applications to remain
implementation independent, they should avoid attempting to create URIs
and instead use those returned by getDefaultURI().
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all of theCacheManagerinstances and associated resources created and maintained by theCachingProvideracross allClassLoaders.voidclose(ClassLoader classLoader) Closes allCacheManagerinstances and associated resources created by theCachingProviderusing the specifiedClassLoader.voidclose(URI uri, ClassLoader classLoader) Closes allCacheManagerinstances and associated resources created by theCachingProviderfor the specifiedURIandClassLoader.Requests aCacheManagerconfigured according to thegetDefaultURI()andgetDefaultProperties()be made available that using thegetDefaultClassLoader()for loading underlying classes.getCacheManager(URI uri, ClassLoader classLoader) Requests aCacheManagerconfigured according to the implementation specificURIthat uses the providedClassLoaderfor loading underlying classes.getCacheManager(URI uri, ClassLoader classLoader, Properties properties) Requests aCacheManagerconfigured according to the implementation specificURIbe made available that uses the providedClassLoaderfor loading underlying classes.Obtains the defaultClassLoaderthat will be used by theCachingProvider.Obtains the defaultPropertiesfor theCachingProvider.Obtains the defaultURIfor theCachingProvider.booleanisSupported(OptionalFeature optionalFeature) Determines whether an optional feature is supported by theCachingProvider.
-
Method Details
-
getCacheManager
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 producedSecurityException- when the operation could not be performed due to the current security settings
-
getDefaultClassLoader
ClassLoader getDefaultClassLoader()Obtains the defaultClassLoaderthat will be used by theCachingProvider.- Returns:
- the default
ClassLoaderused by theCachingProvider
-
getDefaultURI
URI getDefaultURI()Obtains the defaultURIfor theCachingProvider.Use this method to obtain a suitable
URIfor theCachingProvider.- Returns:
- the default
URIfor theCachingProvider
-
getDefaultProperties
Properties getDefaultProperties()Obtains the defaultPropertiesfor theCachingProvider.Use this method to obtain suitable
Propertiesfor theCachingProvider.- Returns:
- the default
Propertiesfor theCachingProvider
-
getCacheManager
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 producedSecurityException- 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:
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
SecurityException- when the operation could not be performed due to the current security settings
-
close
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:
SecurityException- when the operation could not be performed due to the current security settings
-
close
Closes allCacheManagerinstances and associated resources created by theCachingProviderfor the specifiedURIandClassLoader.- Parameters:
uri- theURIto releaseclassLoader- theClassLoaderto release- Throws:
SecurityException- when the operation could not be performed due to the current security settings
-
isSupported
Determines whether an optional feature is supported by theCachingProvider.- Parameters:
optionalFeature- the feature to check for- Returns:
- true if the feature is supported
-