Class EmbeddedCounterManager
- All Implemented Interfaces:
CounterManager
CounterManager implementation for embedded cache manager.- Since:
- 9.0
- Author:
- Pedro Ruivo
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandefineCounter(String name, CounterConfiguration configuration) Defines a counter with the specificnameandCounterConfiguration.defineCounterAsync(String name, CounterConfiguration configuration) getConfiguration(String counterName) getConfigurationAsync(String name) getCounterConfiguration(String counterName) Returns aCollectionof defined counter names.getOrCreateAsync(String counterName) getStrongCounter(String name) Returns theStrongCounterwith that specific name.getStrongCounterAsync(String counterName) longgetWeakCounter(String name) Returns theWeakCounterwith that specific name.getWeakCounterAsync(String counterName) booleanisDefinedAsync(String name) voidIt removes the counter from the cluster.removeAsync(String counterName, boolean keepConfig) voidvoidstart()voidstop()voidundefineCounter(String counterName) It removes the counter and its configuration from the cluster.
-
Field Details
-
OBJECT_NAME
- See Also:
-
-
Constructor Details
-
EmbeddedCounterManager
public EmbeddedCounterManager()
-
-
Method Details
-
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
-
undefineCounter
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
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
-
getWeakCounter
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
-
getOrCreateAsync
-
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
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
- 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
- Specified by:
getConfigurationin interfaceCounterManager- Parameters:
counterName- the counter name.- Returns:
- the counter's
CounterConfigurationornullif the counter is not defined.
-
getConfigurationAsync
-
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
-