Class EmbeddedCounterManager
- java.lang.Object
-
- org.infinispan.counter.impl.manager.EmbeddedCounterManager
-
- All Implemented Interfaces:
CounterManager
@MBean(objectName="CounterManager", description="Component to manage counters") public class EmbeddedCounterManager extends Object implements CounterManagerACounterManagerimplementation for embedded cache manager.- Since:
- 9.0
- Author:
- Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description static StringOBJECT_NAME
-
Constructor Summary
Constructors Constructor Description EmbeddedCounterManager()
-
Method Summary
-
-
-
Field Detail
-
OBJECT_NAME
public static final String OBJECT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
remove
@ManagedOperation(description="Removes the counter\'s value from the cluster. The counter will be re-created when access next time.", displayName="Remove Counter", name="remove") public void remove(String counterName)Description copied from interface:CounterManagerIt removes the counter from the cluster.All instances returned by
CounterManager.getWeakCounter(String)orCounterManager.getStrongCounter(String)are destroyed and they shouldn't be used anymore. Also, the registeredCounterListeners are removed and they aren't invoked anymore.- Specified by:
removein interfaceCounterManager- Parameters:
counterName- The counter's name to remove.
-
removeAsync
public CompletionStage<Void> removeAsync(String counterName, boolean keepConfig)
-
undefineCounter
public void undefineCounter(String counterName)
Description copied from interface:CounterManagerIt removes the counter and its configuration from the cluster.- Specified by:
undefineCounterin interfaceCounterManager- Parameters:
counterName- The counter's name to remove
-
getStrongCounter
public StrongCounter getStrongCounter(String name)
Description copied from interface:CounterManagerReturns theStrongCounterwith that specific name.If the
StrongCounterdoes not exists, it is created based on theCounterConfiguration.Note that the counter must be defined prior to this method invocation using
CounterManager.defineCounter(String, CounterConfiguration)or via global configuration. This method only supportsCounterType.BOUNDED_STRONGandCounterType.UNBOUNDED_STRONGcounters.- Specified by:
getStrongCounterin interfaceCounterManager- Parameters:
name- the counter name.- Returns:
- the
StrongCounterinstance.
-
getStrongCounterAsync
public CompletionStage<StrongCounter> getStrongCounterAsync(String counterName)
-
getWeakCounter
public WeakCounter getWeakCounter(String name)
Description copied from interface:CounterManagerReturns theWeakCounterwith that specific name.If the
WeakCounterdoes not exists, it is created based on theCounterConfiguration.Note that the counter must be defined prior to this method invocation using
CounterManager.defineCounter(String, CounterConfiguration)or via global configuration. This method only supportsCounterType.WEAKcounters.- Specified by:
getWeakCounterin interfaceCounterManager- Parameters:
name- the counter name.- Returns:
- the
WeakCounterinstance.
-
getWeakCounterAsync
public CompletionStage<WeakCounter> getWeakCounterAsync(String counterName)
-
getOrCreateAsync
public CompletionStage<InternalCounterAdmin> getOrCreateAsync(String counterName)
-
getCounterNames
@ManagedOperation(description="Returns a collection of defined counter\'s name.", displayName="Get Defined Counters", name="counters") public Collection<String> getCounterNames()Description copied from interface:CounterManagerReturns aCollectionof defined counter names.- Specified by:
getCounterNamesin interfaceCounterManager- Returns:
- a
Collectionof defined counter names.
-
defineCounterAsync
public CompletableFuture<Boolean> defineCounterAsync(String name, CounterConfiguration configuration)
-
defineCounter
public boolean defineCounter(String name, CounterConfiguration configuration)
Description copied from interface:CounterManagerDefines a counter with the specificnameandCounterConfiguration.It does not overwrite existing configurations.
- Specified by:
defineCounterin interfaceCounterManager- Parameters:
name- the counter name.configuration- the counter configuration- Returns:
trueif successfully defined orfalseif the counter exists or fails to defined.
-
isDefined
public boolean isDefined(String name)
- Specified by:
isDefinedin interfaceCounterManager- Parameters:
name- the counter name.- Returns:
trueif the counter is defined orfalseif the counter is not defined or fails to check.
-
getConfiguration
public CounterConfiguration getConfiguration(String counterName)
- Specified by:
getConfigurationin interfaceCounterManager- Parameters:
counterName- the counter name.- Returns:
- the counter's
CounterConfigurationornullif the counter is not defined.
-
getConfigurationAsync
public CompletableFuture<CounterConfiguration> getConfigurationAsync(String name)
-
getValue
@ManagedOperation(description="Returns the current counter\'s value", displayName="Get Counter\' Value", name="value") public long getValue(String counterName)
-
reset
@ManagedOperation(description="Resets the counter\'s value", displayName="Reset Counter", name="reset") public void reset(String counterName)
-
getCounterConfiguration
@ManagedOperation(description="Returns the counter\'s configuration", displayName="Counter Configuration", name="configuration") public Properties getCounterConfiguration(String counterName)
-
isDefinedAsync
public CompletableFuture<Boolean> isDefinedAsync(String name)
-
-