public class RemoteCounterManager extends Object implements CounterManager
CounterManager
implementation for Hot Rod clients.Constructor and Description |
---|
RemoteCounterManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
defineCounter(String name,
CounterConfiguration configuration)
Defines a counter with the specific
name and CounterConfiguration . |
CounterConfiguration |
getConfiguration(String counterName) |
Collection<String> |
getCounterNames()
Returns a
Collection of defined counter names. |
StrongCounter |
getStrongCounter(String name)
Returns the
StrongCounter with that specific name. |
WeakCounter |
getWeakCounter(String name)
Returns the
WeakCounter with that specific name. |
boolean |
isDefined(String name) |
void |
remove(String counterName)
It removes the counter from the cluster.
|
void |
start(ChannelFactory channelFactory,
Codec codec,
Configuration configuration,
ClientListenerNotifier listenerNotifier) |
void |
stop() |
void |
undefineCounter(String name)
It removes the counter and its configuration from the cluster.
|
public void start(ChannelFactory channelFactory, Codec codec, Configuration configuration, ClientListenerNotifier listenerNotifier)
public StrongCounter getStrongCounter(String name)
CounterManager
StrongCounter
with that specific name.
If the StrongCounter
does not exists, it is created based on the CounterConfiguration
.
Note that the counter must be defined prior to this method invocation using CounterManager.defineCounter(String, CounterConfiguration)
or via global configuration. This method only supports
CounterType.BOUNDED_STRONG
and CounterType.UNBOUNDED_STRONG
counters.
getStrongCounter
in interface CounterManager
name
- the counter name.StrongCounter
instance.public WeakCounter getWeakCounter(String name)
CounterManager
WeakCounter
with that specific name.
If the WeakCounter
does not exists, it is created based on the CounterConfiguration
.
Note that the counter must be defined prior to this method invocation using CounterManager.defineCounter(String, CounterConfiguration)
or via global configuration. This method only supports
CounterType.WEAK
counters.
getWeakCounter
in interface CounterManager
name
- the counter name.WeakCounter
instance.public boolean defineCounter(String name, CounterConfiguration configuration)
CounterManager
name
and CounterConfiguration
.
It does not overwrite existing configurations.
defineCounter
in interface CounterManager
name
- the counter name.configuration
- the counter configurationtrue
if successfully defined or false
if the counter exists or fails to defined.public void undefineCounter(String name)
CounterManager
undefineCounter
in interface CounterManager
name
- The counter's name to removepublic boolean isDefined(String name)
isDefined
in interface CounterManager
name
- the counter name.true
if the counter is defined or false
if the counter is not defined or fails to check.public CounterConfiguration getConfiguration(String counterName)
getConfiguration
in interface CounterManager
counterName
- the counter name.CounterConfiguration
or null
if the counter is not defined.public void remove(String counterName)
CounterManager
All instances returned by CounterManager.getWeakCounter(String)
or CounterManager.getStrongCounter(String)
are destroyed and
they shouldn't be used anymore. Also, the registered CounterListener
s are removed and they aren't invoked
anymore.
remove
in interface CounterManager
counterName
- The counter's name to remove.public Collection<String> getCounterNames()
CounterManager
Collection
of defined counter names.getCounterNames
in interface CounterManager
Collection
of defined counter names.public void stop()
Copyright © 2021 JBoss by Red Hat. All rights reserved.