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 |
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.
|
CompletionStage<Void> |
addListenerAsync(Object listener)
Asynchronous version of
Listenable.addListener(Object) |
EmbeddedCacheManagerAdmin |
administration()
Provides an
EmbeddedCacheManagerAdmin whose methods affect the entire cluster as opposed to a single node. |
boolean |
cacheExists(String cacheName)
A cache is considered to exist if it has been created and started via
one of the
EmbeddedCacheManager.getCache() methods and has not yet been removed via
EmbeddedCacheManager.removeCache(String) . |
void |
close() |
<K,V> Cache<K,V> |
createCache(String name,
Configuration configuration)
Creates a cache on the local node using the supplied configuration.
|
Configuration |
defineConfiguration(String cacheName,
Configuration configuration)
Register a cache configuration in the cache manager.
|
Configuration |
defineConfiguration(String cacheName,
String templateCacheName,
Configuration configurationOverride)
Defines a cache configuration by first reading the template configuration and then applying the override.
|
ClusterExecutor |
executor()
Providess the cache manager based executor.
|
Address |
getAddress()
Warning: the address may be
null before the first clustered cache starts
and after all the clustered caches have been stopped. |
<K,V> Cache<K,V> |
getCache()
Retrieves the default cache associated with this cache container.
|
<K,V> Cache<K,V> |
getCache(String cacheName)
Retrieves a cache by name.
|
<K,V> Cache<K,V> |
getCache(String cacheName,
boolean createIfAbsent)
Similar to
EmbeddedCacheManager.getCache(String) , except if has the option
to not create the cache if it is not already running. |
Configuration |
getCacheConfiguration(String name)
Returns the configuration for the given cache.
|
Set<String> |
getCacheConfigurationNames()
This method returns a collection of all cache configuration names.
|
GlobalConfiguration |
getCacheManagerConfiguration()
Returns global configuration for this CacheManager
|
CacheManagerInfo |
getCacheManagerInfo() |
Set<String> |
getCacheNames()
This method returns a collection of all cache names.
|
ClassWhiteList |
getClassWhiteList() |
String |
getClusterName() |
Address |
getCoordinator() |
Configuration |
getDefaultCacheConfiguration() |
GlobalComponentRegistry |
getGlobalComponentRegistry() |
Health |
getHealth()
Returns an entry point for a Health Check API.
|
Set<Object> |
getListeners()
Deprecated.
|
List<Address> |
getMembers() |
CacheContainerStats |
getStats()
Returns statistics for this cache manager
|
ComponentStatus |
getStatus() |
Subject |
getSubject() |
Transport |
getTransport() |
boolean |
isCoordinator() |
boolean |
isDefaultRunning()
Tests whether the default cache is running.
|
boolean |
isRunning(String cacheName)
Tests whether a 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.
|
CompletionStage<Void> |
removeListenerAsync(Object listener)
Asynchronous version of
Listenable.removeListener(Object) |
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.
|
EmbeddedCacheManager |
withSubject(Subject subject) |
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 a cache configuration is declaratively, in the XML file passed in to the cache
manager.defineConfiguration
in interface EmbeddedCacheManager
cacheName
- name of the cache configurationconfiguration
- the cache configurationpublic Configuration defineConfiguration(String cacheName, String templateCacheName, Configuration configurationOverride)
EmbeddedCacheManager
EmbeddedCacheManager.defineConfiguration(String, Configuration)
.defineConfiguration
in interface EmbeddedCacheManager
cacheName
- name of cache whose configuration is being definedtemplateCacheName
- configuration to use as a templateconfigurationOverride
- configuration overrides on top of the templatepublic void undefineConfiguration(String configurationName)
EmbeddedCacheManager
undefineConfiguration
in interface EmbeddedCacheManager
configurationName
- the named configurationpublic String getClusterName()
getClusterName
in interface EmbeddedCacheManager
public List<Address> getMembers()
getMembers
in interface EmbeddedCacheManager
null
if not connectedpublic Address getAddress()
EmbeddedCacheManager
null
before the first clustered cache starts
and after all the clustered caches have been stopped.getAddress
in interface EmbeddedCacheManager
null
if not connectedpublic Address getCoordinator()
getCoordinator
in interface EmbeddedCacheManager
null
if not connectedpublic boolean isCoordinator()
isCoordinator
in interface EmbeddedCacheManager
null
if not connectedpublic ComponentStatus getStatus()
getStatus
in interface EmbeddedCacheManager
public Configuration getDefaultCacheConfiguration()
getDefaultCacheConfiguration
in interface EmbeddedCacheManager
null
if there is no default cache.public GlobalConfiguration getCacheManagerConfiguration()
EmbeddedCacheManager
getCacheManagerConfiguration
in interface EmbeddedCacheManager
public Configuration getCacheConfiguration(String name)
EmbeddedCacheManager
getCacheConfiguration
in interface EmbeddedCacheManager
public Set<String> getCacheNames()
BasicCacheContainer
getCacheNames
in interface BasicCacheContainer
public Set<String> getCacheConfigurationNames()
EmbeddedCacheManager
ConfigurationBuilderHolder
,
or at runtime via EmbeddedCacheManager.defineConfiguration(String, Configuration)
.
Internal caches defined via InternalCacheRegistry
are not included.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 Health getHealth()
EmbeddedCacheManager
getHealth
in interface EmbeddedCacheManager
EmbeddedCacheManager
.public CacheManagerInfo getCacheManagerInfo()
getCacheManagerInfo
in interface EmbeddedCacheManager
CacheManagerInfo
used to get basic info about the cache manager.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
EmbeddedCacheManager.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
cacheName
- cache to checkpublic EmbeddedCacheManagerAdmin administration()
EmbeddedCacheManager
EmbeddedCacheManagerAdmin
whose methods affect the entire cluster as opposed to a single node.administration
in interface CacheContainer
administration
in interface EmbeddedCacheManager
EmbeddedCacheManagerAdmin
public ClassWhiteList getClassWhiteList()
getClassWhiteList
in interface EmbeddedCacheManager
public <K,V> Cache<K,V> createCache(String name, Configuration configuration)
EmbeddedCacheManager
EmbeddedCacheManager.defineConfiguration(String, Configuration)
and
EmbeddedCacheManager.getCache(String, boolean)
) needs to be invoked on all nodes.createCache
in interface EmbeddedCacheManager
K
- the generic type of the keyV
- the generic type of the valuename
- the name of the cacheconfiguration
- the configuration to use.public <K,V> Cache<K,V> getCache(String cacheName, boolean createIfAbsent)
EmbeddedCacheManager
EmbeddedCacheManager.getCache(String)
, except if has the option
to not create the cache if it is not already running.getCache
in interface EmbeddedCacheManager
cacheName
- name of cache to retrievecreateIfAbsent
- If true, this methods works just like EmbeddedCacheManager.getCache(String)
.
If false, return the already running cache or null.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()
EmbeddedCacheManager
getCache
in interface BasicCacheContainer
getCache
in interface CacheContainer
getCache
in interface EmbeddedCacheManager
public <K,V> Cache<K,V> getCache(String cacheName)
EmbeddedCacheManager
getCache
in interface BasicCacheContainer
getCache
in interface CacheContainer
getCache
in interface EmbeddedCacheManager
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
- listener to add, must not be nullpublic CompletionStage<Void> addListenerAsync(Object listener)
Listenable
Listenable.addListener(Object)
addListenerAsync
in interface Listenable
listener
- listener to add, must not be nullpublic void removeListener(Object listener)
Listenable
removeListener
in interface Listenable
listener
- listener to remove. Must not be null.public CompletionStage<Void> removeListenerAsync(Object listener)
Listenable
Listenable.removeListener(Object)
removeListenerAsync
in interface Listenable
listener
- listener to remove, must not be null@Deprecated public Set<Object> getListeners()
getListeners
in interface Listenable
public CacheContainerStats getStats()
EmbeddedCacheManager
getStats
in interface EmbeddedCacheManager
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public EmbeddedCacheManager withSubject(Subject subject)
withSubject
in interface EmbeddedCacheManager
public Subject getSubject()
getSubject
in interface EmbeddedCacheManager
Copyright © 2021 JBoss by Red Hat. All rights reserved.