Class RemoteCounterManager
- java.lang.Object
-
- org.infinispan.client.hotrod.counter.impl.RemoteCounterManager
-
- All Implemented Interfaces:
CounterManager
public class RemoteCounterManager extends Object implements CounterManager
ACounterManager
implementation for Hot Rod clients.- Since:
- 9.2
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description RemoteCounterManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
defineCounter(String name, CounterConfiguration configuration)
Defines a counter with the specificname
andCounterConfiguration
.CounterConfiguration
getConfiguration(String counterName)
Collection<String>
getCounterNames()
Returns aCollection
of defined counter names.StrongCounter
getStrongCounter(String name)
Returns theStrongCounter
with that specific name.WeakCounter
getWeakCounter(String name)
Returns theWeakCounter
with that specific name.boolean
isDefined(String name)
void
remove(String counterName)
It removes the counter from the cluster.void
start(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory channelFactory, org.infinispan.client.hotrod.impl.protocol.Codec codec, Configuration configuration, ClientListenerNotifier listenerNotifier)
void
stop()
-
-
-
Method Detail
-
start
public void start(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory channelFactory, org.infinispan.client.hotrod.impl.protocol.Codec codec, Configuration configuration, ClientListenerNotifier listenerNotifier)
-
getStrongCounter
public StrongCounter getStrongCounter(String name)
Description copied from interface:CounterManager
Returns theStrongCounter
with that specific name.If the
StrongCounter
does 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_STRONG
andCounterType.UNBOUNDED_STRONG
counters.- Specified by:
getStrongCounter
in interfaceCounterManager
- Parameters:
name
- the counter name.- Returns:
- the
StrongCounter
instance.
-
getWeakCounter
public WeakCounter getWeakCounter(String name)
Description copied from interface:CounterManager
Returns theWeakCounter
with that specific name.If the
WeakCounter
does 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.WEAK
counters.- Specified by:
getWeakCounter
in interfaceCounterManager
- Parameters:
name
- the counter name.- Returns:
- the
WeakCounter
instance.
-
defineCounter
public boolean defineCounter(String name, CounterConfiguration configuration)
Description copied from interface:CounterManager
Defines a counter with the specificname
andCounterConfiguration
.It does not overwrite existing configurations.
- Specified by:
defineCounter
in interfaceCounterManager
- Parameters:
name
- the counter name.configuration
- the counter configuration- Returns:
true
if successfully defined orfalse
if the counter exists or fails to defined.
-
isDefined
public boolean isDefined(String name)
- Specified by:
isDefined
in interfaceCounterManager
- Parameters:
name
- the counter name.- Returns:
true
if the counter is defined orfalse
if the counter is not defined or fails to check.
-
getConfiguration
public CounterConfiguration getConfiguration(String counterName)
- Specified by:
getConfiguration
in interfaceCounterManager
- Parameters:
counterName
- the counter name.- Returns:
- the counter's
CounterConfiguration
ornull
if the counter is not defined.
-
remove
public void remove(String counterName)
Description copied from interface:CounterManager
It 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 registeredCounterListener
s are removed and they aren't invoked anymore.- Specified by:
remove
in interfaceCounterManager
- Parameters:
counterName
- The counter's name to remove.
-
getCounterNames
public Collection<String> getCounterNames()
Description copied from interface:CounterManager
Returns aCollection
of defined counter names.- Specified by:
getCounterNames
in interfaceCounterManager
- Returns:
- a
Collection
of defined counter names.
-
stop
public void stop()
-
-