public class CoherenceBasedCachingProvider extends Object implements javax.cache.spi.CachingProvider
CachingProvider
.
Added support to recognize and work within a container environment.
Calls to JCache API from container code should call CachingProvider#getCacheManager(null, null, null)
in order that container descriptor file coherence-application.xml is used to initialize CacheManager.Constructor and Description |
---|
CoherenceBasedCachingProvider()
Constructs a
CoherenceBasedCachingProvider . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
close(ClassLoader cl) |
void |
close(URI u,
ClassLoader cl) |
protected <K,V> CoherenceBasedConfiguration<K,V> |
convertConfiguration(javax.cache.configuration.Configuration<K,V> cfg,
ClassLoader classLoader)
Converts a
Configuration into a CoherenceBasedConfiguration so that we may
create CoherenceBasedCache s. |
protected javax.cache.CacheManager |
createCacheMananger(URI uri,
ClassLoader classLoader,
Properties properties)
Constructs a suitable
CacheManager for the specified parameters. |
javax.cache.CacheManager |
getCacheManager() |
javax.cache.CacheManager |
getCacheManager(URI uri,
ClassLoader cl) |
javax.cache.CacheManager |
getCacheManager(URI u,
ClassLoader cl,
Properties p)
Return a CacheManager.
|
ClassLoader |
getDefaultClassLoader()
Returns a non-null ClassLoader.
|
String |
getDefaultCoherenceBasedConfigurationClassName()
Determines the fully-qualified-class-name of the default
CoherenceBasedConfiguration class to use when provided
with a JCache Configuration . |
Properties |
getDefaultProperties() |
URI |
getDefaultURI() |
boolean |
isSupported(javax.cache.configuration.OptionalFeature feature) |
void |
release(ClassLoader c,
URI u)
Releases the CacheManager with the specified URI and ClassLoader
from this CachingProvider.
|
public CoherenceBasedCachingProvider()
CoherenceBasedCachingProvider
.public javax.cache.CacheManager getCacheManager(URI u, ClassLoader cl, Properties p)
To get a container managed CacheManager
, any container code calling this method MUST
call this method with a null uri parameter. Calling with a non-null value results in a non-container managed
CacheManager
. Container managed instances are configured via GAR configuration and are created/closed
by container.
If this method is called from a container context with a non-null URI, the returned CacheManager
is considered
unmanaged.
getCacheManager
in interface javax.cache.spi.CachingProvider
u
- A URI
referencing a coherence cache config containing JCacheNamespace or JCacheExtendNamespace.
A value of null denotes to compute the default URI for this CacheManager
.cl
- classloaderp
- Coherence JCache implementation specific Properties
CacheManager
public ClassLoader getDefaultClassLoader()
getDefaultClassLoader
in interface javax.cache.spi.CachingProvider
public URI getDefaultURI()
getDefaultURI
in interface javax.cache.spi.CachingProvider
public Properties getDefaultProperties()
getDefaultProperties
in interface javax.cache.spi.CachingProvider
public javax.cache.CacheManager getCacheManager(URI uri, ClassLoader cl)
getCacheManager
in interface javax.cache.spi.CachingProvider
public javax.cache.CacheManager getCacheManager()
getCacheManager
in interface javax.cache.spi.CachingProvider
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface javax.cache.spi.CachingProvider
public void close(ClassLoader cl)
close
in interface javax.cache.spi.CachingProvider
public void close(URI u, ClassLoader cl)
close
in interface javax.cache.spi.CachingProvider
public boolean isSupported(javax.cache.configuration.OptionalFeature feature)
isSupported
in interface javax.cache.spi.CachingProvider
public void release(ClassLoader c, URI u)
This method does nothing if a CacheManager matching the specified parameters is not being tracked.
c
- the ClassLoader of the CacheManageru
- the URI of the CacheManagerprotected javax.cache.CacheManager createCacheMananger(URI uri, ClassLoader classLoader, Properties properties)
CacheManager
for the specified parameters.
This method may be overridden by sub-classes to provide specialized
CacheManager
implementations.
uri
- the CacheManager
URI
classLoader
- the ClassLoader
for the returned CacheManager
properties
- the custom Properties
for the CacheManager
CacheManager
protected <K,V> CoherenceBasedConfiguration<K,V> convertConfiguration(javax.cache.configuration.Configuration<K,V> cfg, ClassLoader classLoader)
Configuration
into a CoherenceBasedConfiguration
so that we may
create CoherenceBasedCache
s.K
- the key typeV
- the value typecfg
- the Configuration
to convertclassLoader
- the ClassLoader
to use to locate a suitable CoherenceBasedConfiguration
(when necessary)CoherenceBasedConfiguration
for use with a CoherenceBasedCacheManager
public String getDefaultCoherenceBasedConfigurationClassName()
CoherenceBasedConfiguration
class to use when provided
with a JCache Configuration
.CoherenceBasedConfiguration