Class CompareAndSwapFunction<K extends CounterKey>
- java.lang.Object
-
- org.infinispan.counter.impl.function.CompareAndSwapFunction<K>
-
- All Implemented Interfaces:
Function<org.infinispan.functional.EntryView.ReadWriteEntryView<K,CounterValue>,Object>
public class CompareAndSwapFunction<K extends CounterKey> extends Object
The compare-and-swap function to update theCounterValue.It returns the previous value and it is considered successful when the return value is the
expected.For a bounded counter (if the current value is equal to the
expected), if thevalueis outside the bounds, it returnsCounterState.LOWER_BOUND_REACHEDorCounterState.UPPER_BOUND_REACHEDif the lower bound or upper bound is violated.- Since:
- 9.2
- Author:
- Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description static org.infinispan.commons.marshall.AdvancedExternalizer<CompareAndSwapFunction>EXTERNALIZER
-
Constructor Summary
Constructors Constructor Description CompareAndSwapFunction(long expect, long value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rapply(org.infinispan.functional.EntryView.ReadWriteEntryView<K,CounterValue> entryView)protected LoggetLog()
-
-
-
Field Detail
-
EXTERNALIZER
public static final org.infinispan.commons.marshall.AdvancedExternalizer<CompareAndSwapFunction> EXTERNALIZER
-
-
Method Detail
-
getLog
protected Log getLog()
-
apply
public final R apply(org.infinispan.functional.EntryView.ReadWriteEntryView<K,CounterValue> entryView)
- Specified by:
applyin interfaceFunction<K extends CounterKey,R>
-
-