public class AbstractDelegatingEmbeddedCacheManager extends Object implements EmbeddedCacheManager
EmbeddedCacheManager
argument, to which each method call is delegated. One can extend this class and only override the method sub-set
it is interested in.AbstractDelegatingCache
,
AbstractDelegatingAdvancedCache
Modifier and Type | Field and Description |
---|---|
protected EmbeddedCacheManager |
cm |
DEFAULT_CACHE_NAME
Constructor and Description |
---|
AbstractDelegatingEmbeddedCacheManager(EmbeddedCacheManager cm) |
Modifier and Type | Method and Description |
---|---|
void |
addCacheDependency(String from,
String to)
Add a dependency between two caches.
|
void |
addListener(Object listener)
Adds a listener to the component.
|
boolean |
cacheExists(String cacheName)
A cache is considered to exist if it has been created and started via
one of the
CacheContainer.getCache() methods and has not yet been removed via
EmbeddedCacheManager.removeCache(String) . |
Configuration |
defineConfiguration(String cacheName,
Configuration configuration)
Defines a named cache's configuration using the following algorithm:
Unlike previous versions of Infinispan, this method does not build on an existing configuration (default or named).
|
Configuration |
defineConfiguration(String cacheName,
String templateCacheName,
Configuration configurationOverride)
Defines a named cache's configuration using the following algorithm:
Regardless of whether the cache name has been defined or not, this method creates a clone of the configuration of
the cache whose name matches the given template cache name, then applies a clone of the configuration overrides
passed in and finally returns this configuration instance.
|
ClusterExecutor |
executor()
Providess the cache manager based executor.
|
Address |
getAddress() |
<K,V> Cache<K,V> |
getCache()
This method overrides the underlying
CacheContainer.getCache() ,
to return a Cache instead of a BasicCache |
<K,V> Cache<K,V> |
getCache(String cacheName)
This method overrides the underlying
CacheContainer.getCache(String) ,
to return a Cache instead of a BasicCache |
<K,V> Cache<K,V> |
getCache(String cacheName,
boolean createIfAbsent)
Retrieves a named cache from the system in the same way that
CacheContainer.getCache(String) does except that if offers the possibility for the
named cache not to be retrieved if it has not yet been started, or if
it's been removed after being started. |
<K,V> Cache<K,V> |
getCache(String cacheName,
String configurationName)
Retrieves a named cache from the system in the same way that
CacheContainer.getCache(String) does except that if offers the possibility to specify
a specific configuration template. |
<K,V> Cache<K,V> |
getCache(String cacheName,
String configurationTemplate,
boolean createIfAbsent)
Retrieves a named cache from the system in the same way that
CacheContainer.getCache(String) does except that if offers the possibility to specify
a specific configuration template. |
Configuration |
getCacheConfiguration(String name)
Returns the configuration for the given cache.
|
Set<String> |
getCacheConfigurationNames()
This method returns a collection of cache configuration names which contains the
cache configurations that have been defined via XML or programmatically, and the
cache configurations that have been defined at runtime via this cache manager
instance.
|
GlobalConfiguration |
getCacheManagerConfiguration()
Returns global configuration for this CacheManager
|
Set<String> |
getCacheNames()
This method returns a collection of caches names which contains the
caches that have been defined via XML or programmatically, and the
caches that have been created at runtime via this cache manager
instance.
|
String |
getClusterName() |
Address |
getCoordinator() |
Configuration |
getDefaultCacheConfiguration()
Returns default configuration for this CacheManager
|
GlobalComponentRegistry |
getGlobalComponentRegistry() |
Set<Object> |
getListeners() |
List<Address> |
getMembers() |
CacheContainerStats |
getStats()
Returns statistics for this cache manager
since 7.1
|
ComponentStatus |
getStatus() |
Transport |
getTransport() |
boolean |
isCoordinator() |
boolean |
isDefaultRunning()
Tests whether the default cache is running.
|
boolean |
isRunning(String cacheName)
Tests whether a named cache is running.
|
void |
removeCache(String cacheName)
Removes a cache with the given name from the system.
|
void |
removeListener(Object listener)
Removes a listener from the component.
|
void |
start()
Invoked on component start
|
EmbeddedCacheManager |
startCaches(String... cacheNames)
Starts a set of caches in parallel.
|
void |
stop()
Invoked on component stop
|
void |
undefineConfiguration(String configurationName)
Removes a configuration from the set of defined configurations.
|
protected EmbeddedCacheManager cm
public AbstractDelegatingEmbeddedCacheManager(EmbeddedCacheManager cm)
public Configuration defineConfiguration(String cacheName, Configuration configuration)
EmbeddedCacheManager
ConfigurationBuilder.read(org.infinispan.configuration.cache.Configuration)
.
The other way to define named cache's configuration is declaratively, in the XML file passed in to the cache
manager. This method enables you to override certain properties that have previously been defined via XML.
Passing a brand new Configuration instance as configuration override without having called any of its setters will
effectively return the named cache's configuration since no overrides where passed to it.defineConfiguration
in interface EmbeddedCacheManager
cacheName
- name of cache whose configuration is being definedconfiguration
- configuration overrides to usepublic Configuration defineConfiguration(String cacheName, String templateCacheName, Configuration configurationOverride)
EmbeddedCacheManager
EmbeddedCacheManager.defineConfiguration(String, Configuration)
in the sense that the base configuration used is the default cache
configuration.defineConfiguration
in interface EmbeddedCacheManager
cacheName
- name of cache whose configuration is being definedtemplateCacheName
- name of cache to which to which apply overrides if cache name has not been previously
definedconfigurationOverride
- configuration overrides to usepublic void undefineConfiguration(String configurationName)
EmbeddedCacheManager
IllegalStateException
is thrown. If the named configuration does not exist, nothing
happensundefineConfiguration
in interface EmbeddedCacheManager
configurationName
- the named configurationpublic String getClusterName()
getClusterName
in interface EmbeddedCacheManager
public List<Address> getMembers()
getMembers
in interface EmbeddedCacheManager
public Address getAddress()
getAddress
in interface EmbeddedCacheManager
public Address getCoordinator()
getCoordinator
in interface EmbeddedCacheManager
public boolean isCoordinator()
isCoordinator
in interface EmbeddedCacheManager
public ComponentStatus getStatus()
getStatus
in interface EmbeddedCacheManager
public Configuration getDefaultCacheConfiguration()
EmbeddedCacheManager
getDefaultCacheConfiguration
in interface EmbeddedCacheManager
public GlobalConfiguration getCacheManagerConfiguration()
EmbeddedCacheManager
getCacheManagerConfiguration
in interface EmbeddedCacheManager
public Configuration getCacheConfiguration(String name)
EmbeddedCacheManager
getCacheConfiguration
in interface EmbeddedCacheManager
public Set<String> getCacheNames()
EmbeddedCacheManager
InternalCacheRegistry
getCacheNames
in interface EmbeddedCacheManager
public Set<String> getCacheConfigurationNames()
EmbeddedCacheManager
InternalCacheRegistry
getCacheConfigurationNames
in interface EmbeddedCacheManager
public ClusterExecutor executor()
EmbeddedCacheManager
Note that not all EmbeddedCacheManager
implementations may implement this. Those that don't will throw
a UnsupportedOperationException
upon invocation.
executor
in interface EmbeddedCacheManager
public boolean isRunning(String cacheName)
EmbeddedCacheManager
isRunning
in interface EmbeddedCacheManager
cacheName
- name of cache to test.public boolean isDefaultRunning()
EmbeddedCacheManager
isDefaultRunning
in interface EmbeddedCacheManager
public boolean cacheExists(String cacheName)
EmbeddedCacheManager
CacheContainer.getCache()
methods and has not yet been removed via
EmbeddedCacheManager.removeCache(String)
.
In environments when caches are continuously created and removed, this
method offers the possibility to find out whether a cache has either,
not been started, or if it was started, whether it's been removed already
or not.cacheExists
in interface EmbeddedCacheManager
public <K,V> Cache<K,V> getCache(String cacheName, boolean createIfAbsent)
EmbeddedCacheManager
CacheContainer.getCache(String)
does except that if offers the possibility for the
named cache not to be retrieved if it has not yet been started, or if
it's been removed after being started. If a non-template configuration
exists with the same name, it will be used to configure the cache.getCache
in interface EmbeddedCacheManager
cacheName
- name of cache to retrievecreateIfAbsent
- if false, the named cache will not be
retrieved if it hasn't been retrieved previously or if it's been
removed. If true, this methods works just like CacheContainer.getCache(String)
public <K,V> Cache<K,V> getCache(String cacheName, String configurationName)
EmbeddedCacheManager
CacheContainer.getCache(String)
does except that if offers the possibility to specify
a specific configuration template. Multiple caches can be created using
the same configuration.getCache
in interface EmbeddedCacheManager
cacheName
- name of cache to retrieveconfigurationName
- name of the configuration template to usepublic <K,V> Cache<K,V> getCache(String cacheName, String configurationTemplate, boolean createIfAbsent)
EmbeddedCacheManager
CacheContainer.getCache(String)
does except that if offers the possibility to specify
a specific configuration template. Multiple caches can be created using
the same configuration. Tihs method also offers the possibility for the
named cache not to be retrieved if it has not yet been started, or if
it's been removed after being started.getCache
in interface EmbeddedCacheManager
cacheName
- name of cache to retrieveconfigurationTemplate
- name of the configuration template to usecreateIfAbsent
- if false, the named cache will not be
retrieved if it hasn't been retrieved previously or if it's been
removed. If true, this methods works just like EmbeddedCacheManager.getCache(String, String)
public EmbeddedCacheManager startCaches(String... cacheNames)
EmbeddedCacheManager
startCaches
in interface EmbeddedCacheManager
cacheNames
- the names of the caches to startpublic void removeCache(String cacheName)
EmbeddedCacheManager
removeCache
in interface EmbeddedCacheManager
cacheName
- name of cache to removepublic Transport getTransport()
getTransport
in interface EmbeddedCacheManager
public <K,V> Cache<K,V> getCache()
CacheContainer
CacheContainer.getCache()
,
to return a Cache
instead of a BasicCache
getCache
in interface BasicCacheContainer
getCache
in interface CacheContainer
public <K,V> Cache<K,V> getCache(String cacheName)
CacheContainer
CacheContainer.getCache(String)
,
to return a Cache
instead of a BasicCache
getCache
in interface BasicCacheContainer
getCache
in interface CacheContainer
cacheName
- name of cache to retrievepublic void start()
Lifecycle
public void stop()
Lifecycle
public GlobalComponentRegistry getGlobalComponentRegistry()
getGlobalComponentRegistry
in interface EmbeddedCacheManager
public void addCacheDependency(String from, String to)
EmbeddedCacheManager
addCacheDependency
in interface EmbeddedCacheManager
from
- cache nameto
- cache namepublic void addListener(Object listener)
Listenable
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
addListener
in interface Listenable
listener
- must not be null.public void removeListener(Object listener)
Listenable
removeListener
in interface Listenable
listener
- listener to remove. Must not be null.public Set<Object> getListeners()
getListeners
in interface Listenable
public CacheContainerStats getStats()
EmbeddedCacheManager
getStats
in interface EmbeddedCacheManager
Copyright © 2021 JBoss, a division of Red Hat. All rights reserved.