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,InternalCounterAdmin
A bounded strong consistent counter.
When the boundaries are reached, a CounterOutOfBoundsException is thrown. Use CounterOutOfBoundsException.isUpperBoundReached() or CounterOutOfBoundsException.isLowerBoundReached() to
check if upper or lower bound has been reached, respectively.
- Since:
- 9.0
- Author:
- Pedro Ruivo
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedStrongCounter(String counterName, org.infinispan.AdvancedCache<StrongCounterKey, CounterValue> cache, org.infinispan.counter.api.CounterConfiguration configuration, CounterManagerNotificationManager notificationManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected longhandleAddResult(CounterValue counterValue) Extracts and validates the value after a read.protected LonghandleCASResult(Object state) protected LonghandleSetResult(Object state) toString()Methods inherited from class org.infinispan.counter.impl.strong.AbstractStrongCounter
addAndGet, addListener, asStrongCounter, compareAndSwap, destroy, generate, getAndSet, getConfiguration, getName, getValue, init, isWeakCounter, remove, removeStrongCounter, reset, sync, valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.counter.impl.manager.InternalCounterAdmin
asWeakCounterMethods inherited from interface org.infinispan.counter.api.StrongCounter
compareAndSet, decrementAndGet, incrementAndGet
-
Constructor Details
-
BoundedStrongCounter
public BoundedStrongCounter(String counterName, org.infinispan.AdvancedCache<StrongCounterKey, CounterValue> cache, org.infinispan.counter.api.CounterConfiguration configuration, CounterManagerNotificationManager notificationManager)
-
-
Method Details
-
handleAddResult
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.
-
handleSetResult
- Specified by:
handleSetResultin classAbstractStrongCounter
-
handleCASResult
- Specified by:
handleCASResultin classAbstractStrongCounter
-
toString
-