public class CacheManagerImpl extends Object implements CacheManager
CacheManager.| Constructor and Description |
|---|
CacheManagerImpl()
Create a new CacheRegistryImpl.
|
CacheManagerImpl(ConfigurationRegistry configRegistry,
org.jgroups.ChannelFactory factory)
Create a new CacheRegistryImpl using the provided ConfigurationRegistry
and ChannelFactory.
|
CacheManagerImpl(String configFileName,
org.jgroups.ChannelFactory factory)
Create a new CacheRegistryImpl using the provided ChannelFactory and
using the provided file name to create an
XmlParsingConfigurationRegistry. |
| Modifier and Type | Method and Description |
|---|---|
protected Cache<Object,Object> |
createCache(Configuration config)
Extension point for subclasses, where we actually use a
CacheFactory to create a cache. |
Cache<Object,Object> |
getCache(String configName,
boolean create)
Get a cache configured according to the given configuration name,
optionally instantiating the cache if it hasn't already been
instantiated.
|
Set<String> |
getCacheNames()
Gets the name of all caches that are registered, i.e.
|
org.jgroups.ChannelFactory |
getChannelFactory()
Gets the JGroups
ChannelFactory that will be injected
into any Configuration that has a
multiplexer stack
configured. |
Set<String> |
getConfigurationNames()
Gets the names of all the configurations of which this object
is aware.
|
ConfigurationRegistry |
getConfigurationRegistry() |
void |
registerCache(Cache<Object,Object> cache,
String configName) |
void |
releaseCache(String configName)
Notifies the registry that the caller is no longer using the given
cache.
|
void |
setChannelFactory(org.jgroups.ChannelFactory channelFactory) |
void |
setConfigurationRegistry(ConfigurationRegistry configRegistry) |
void |
start() |
void |
stop() |
public CacheManagerImpl()
public CacheManagerImpl(ConfigurationRegistry configRegistry, org.jgroups.ChannelFactory factory)
public CacheManagerImpl(String configFileName, org.jgroups.ChannelFactory factory)
XmlParsingConfigurationRegistry.public org.jgroups.ChannelFactory getChannelFactory()
CacheManagerChannelFactory that will be injected
into any Configuration that has a
multiplexer stack
configured.getChannelFactory in interface CacheManagerpublic Set<String> getConfigurationNames()
CacheManagergetConfigurationNames in interface CacheManagernull.public Set<String> getCacheNames()
CacheManagergetCache(name, false).getCacheNames in interface CacheManagernull.public Cache<Object,Object> getCache(String configName, boolean create) throws Exception
CacheManager
The caller is free to invoke the Cache.create() and
Cache.start() lifecycle methods on the returned cache, but
the @link Cache#stop()} and Cache.destroy() methods should not
be invoked, since it is quite possible other users are still using the
cache. Use CacheManager.releaseCache(String) to notify this
registry that the caller is no longer using a cache; let the registry
control stopping and destroying the cache.
If invoking this method leads to the instantiation of the cache,
create() and start() will not be invoked
on the cache before it is returned.
getCache in interface CacheManagerconfigName - the name of the configurationcreate - should the cache be instantiated if it
hasn't already been?null if
create is false and the cache hasn't
been created previously.IllegalArgumentException - if this object is unaware of
configName; i.e. the set
returned from CacheManager.getConfigurationNames()
does not include configNameException - if there is a problem instantiating the cacheprotected Cache<Object,Object> createCache(Configuration config)
CacheFactory to create a cache. This default implementation
uses DefaultCacheFactory.config - the Configuration for the cachepublic void releaseCache(String configName)
CacheManagerreleaseCache in interface CacheManagerpublic ConfigurationRegistry getConfigurationRegistry()
public void setConfigurationRegistry(ConfigurationRegistry configRegistry)
public void setChannelFactory(org.jgroups.ChannelFactory channelFactory)
public void stop()
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.