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>
The compare-and-swap function to update the
CounterValue.
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 the value is outside the
bounds, it returns CounterState.LOWER_BOUND_REACHED or CounterState.UPPER_BOUND_REACHED if the lower
bound or upper bound is violated.
- Since:
- 9.2
- Author:
- Pedro Ruivo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.infinispan.commons.marshall.AdvancedExternalizer<CompareAndSwapFunction> -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
EXTERNALIZER
public static final org.infinispan.commons.marshall.AdvancedExternalizer<CompareAndSwapFunction> EXTERNALIZER
-
-
Constructor Details
-
CompareAndSwapFunction
public CompareAndSwapFunction(long expect, long value)
-
-
Method Details
-
getLog
-
apply
public final Object apply(org.infinispan.functional.EntryView.ReadWriteEntryView<K, CounterValue> entryView) - Specified by:
applyin interfaceFunction<K extends CounterKey,R>
-