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)
EmbeddedCacheManagerConfigurationBuilder.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 EmbeddedCacheManagercacheName - name of the cache configurationconfiguration - the cache configurationpublic Configuration defineConfiguration(String cacheName, String templateCacheName, Configuration configurationOverride)
EmbeddedCacheManagerEmbeddedCacheManager.defineConfiguration(String, Configuration).defineConfiguration in interface EmbeddedCacheManagercacheName - 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)
EmbeddedCacheManagerundefineConfiguration in interface EmbeddedCacheManagerconfigurationName - the named configurationpublic String getClusterName()
getClusterName in interface EmbeddedCacheManagerpublic List<Address> getMembers()
getMembers in interface EmbeddedCacheManagernull if not connectedpublic Address getAddress()
EmbeddedCacheManagernull before the first clustered cache starts
and after all the clustered caches have been stopped.getAddress in interface EmbeddedCacheManagernull if not connectedpublic Address getCoordinator()
getCoordinator in interface EmbeddedCacheManagernull if not connectedpublic boolean isCoordinator()
isCoordinator in interface EmbeddedCacheManagernull if not connectedpublic ComponentStatus getStatus()
getStatus in interface EmbeddedCacheManagerpublic Configuration getDefaultCacheConfiguration()
getDefaultCacheConfiguration in interface EmbeddedCacheManagernull if there is no default cache.public GlobalConfiguration getCacheManagerConfiguration()
EmbeddedCacheManagergetCacheManagerConfiguration in interface EmbeddedCacheManagerpublic Configuration getCacheConfiguration(String name)
EmbeddedCacheManagergetCacheConfiguration in interface EmbeddedCacheManagerpublic Set<String> getCacheNames()
BasicCacheContainergetCacheNames in interface BasicCacheContainerpublic Set<String> getCacheConfigurationNames()
EmbeddedCacheManagerConfigurationBuilderHolder,
or at runtime via EmbeddedCacheManager.defineConfiguration(String, Configuration).
Internal caches defined via InternalCacheRegistry
are not included.getCacheConfigurationNames in interface EmbeddedCacheManagerpublic 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 EmbeddedCacheManagerpublic Health getHealth()
EmbeddedCacheManagergetHealth in interface EmbeddedCacheManagerEmbeddedCacheManager.public CacheManagerInfo getCacheManagerInfo()
getCacheManagerInfo in interface EmbeddedCacheManagerCacheManagerInfo used to get basic info about the cache manager.public boolean isRunning(String cacheName)
EmbeddedCacheManagerisRunning in interface EmbeddedCacheManagercacheName - name of cache to test.public boolean isDefaultRunning()
EmbeddedCacheManagerisDefaultRunning in interface EmbeddedCacheManagerpublic boolean cacheExists(String cacheName)
EmbeddedCacheManagerEmbeddedCacheManager.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 EmbeddedCacheManagercacheName - cache to checkpublic EmbeddedCacheManagerAdmin administration()
EmbeddedCacheManagerEmbeddedCacheManagerAdmin whose methods affect the entire cluster as opposed to a single node.administration in interface CacheContaineradministration in interface EmbeddedCacheManagerEmbeddedCacheManagerAdminpublic ClassWhiteList getClassWhiteList()
getClassWhiteList in interface EmbeddedCacheManagerpublic <K,V> Cache<K,V> createCache(String name, Configuration configuration)
EmbeddedCacheManagerEmbeddedCacheManager.defineConfiguration(String, Configuration) and
EmbeddedCacheManager.getCache(String, boolean)) needs to be invoked on all nodes.createCache in interface EmbeddedCacheManagerK - 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)
EmbeddedCacheManagerEmbeddedCacheManager.getCache(String), except if has the option
to not create the cache if it is not already running.getCache in interface EmbeddedCacheManagercacheName - 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)
EmbeddedCacheManagerstartCaches in interface EmbeddedCacheManagercacheNames - the names of the caches to startpublic void removeCache(String cacheName)
EmbeddedCacheManagerremoveCache in interface EmbeddedCacheManagercacheName - name of cache to removepublic Transport getTransport()
getTransport in interface EmbeddedCacheManagerpublic <K,V> Cache<K,V> getCache()
EmbeddedCacheManagergetCache in interface BasicCacheContainergetCache in interface CacheContainergetCache in interface EmbeddedCacheManagerpublic <K,V> Cache<K,V> getCache(String cacheName)
EmbeddedCacheManagergetCache in interface BasicCacheContainergetCache in interface CacheContainergetCache in interface EmbeddedCacheManagercacheName - name of cache to retrievepublic void start()
Lifecyclepublic void stop()
Lifecyclepublic GlobalComponentRegistry getGlobalComponentRegistry()
getGlobalComponentRegistry in interface EmbeddedCacheManagerpublic void addCacheDependency(String from, String to)
EmbeddedCacheManageraddCacheDependency in interface EmbeddedCacheManagerfrom - cache nameto - cache namepublic void addListener(Object listener)
ListenableListener 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 Listenablelistener - listener to add, must not be nullpublic CompletionStage<Void> addListenerAsync(Object listener)
ListenableListenable.addListener(Object)addListenerAsync in interface Listenablelistener - listener to add, must not be nullpublic void removeListener(Object listener)
ListenableremoveListener in interface Listenablelistener - listener to remove. Must not be null.public CompletionStage<Void> removeListenerAsync(Object listener)
ListenableListenable.removeListener(Object)removeListenerAsync in interface Listenablelistener - listener to remove, must not be null@Deprecated public Set<Object> getListeners()
getListeners in interface Listenablepublic CacheContainerStats getStats()
EmbeddedCacheManagergetStats in interface EmbeddedCacheManagerpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic EmbeddedCacheManager withSubject(Subject subject)
withSubject in interface EmbeddedCacheManagerpublic Subject getSubject()
getSubject in interface EmbeddedCacheManagerCopyright © 2022 JBoss by Red Hat. All rights reserved.