Class BoundedStrongCounter
- java.lang.Object
-
- org.infinispan.counter.impl.strong.AbstractStrongCounter
-
- org.infinispan.counter.impl.strong.BoundedStrongCounter
-
- All Implemented Interfaces:
org.infinispan.counter.api.StrongCounter,CounterEventGenerator
public class BoundedStrongCounter extends AbstractStrongCounter
A bounded strong consistent counter.When the boundaries are reached, a
CounterOutOfBoundsExceptionis thrown. UseCounterOutOfBoundsException.isUpperBoundReached()orCounterOutOfBoundsException.isLowerBoundReached()to check if upper or lower bound has been reached, respectively.- Since:
- 9.0
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description BoundedStrongCounter(String counterName, org.infinispan.AdvancedCache<StrongCounterKey,CounterValue> cache, org.infinispan.counter.api.CounterConfiguration configuration, CounterManagerNotificationManager notificationManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longhandleAddResult(CounterValue counterValue)Extracts and validates the value after a read.protected LonghandleCASResult(Object state)StringtoString()-
Methods inherited from class org.infinispan.counter.impl.strong.AbstractStrongCounter
addAndGet, addListener, compareAndSwap, destroyAndRemove, generate, getConfiguration, getName, getValue, init, remove, removeStrongCounter, reset, sync
-
-
-
-
Constructor Detail
-
BoundedStrongCounter
public BoundedStrongCounter(String counterName, org.infinispan.AdvancedCache<StrongCounterKey,CounterValue> cache, org.infinispan.counter.api.CounterConfiguration configuration, CounterManagerNotificationManager notificationManager)
-
-
Method Detail
-
handleAddResult
protected long handleAddResult(CounterValue counterValue)
Description copied from class:AbstractStrongCounterExtracts and validates the value after a read.Any exception should be thrown using
CompletionException.- Specified by:
handleAddResultin classAbstractStrongCounter- Parameters:
counterValue- The newCounterValue.- Returns:
- The new value stored in
CounterValue.
-
handleCASResult
protected Long handleCASResult(Object state)
- Specified by:
handleCASResultin classAbstractStrongCounter
-
-