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 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 Details

    • EXTERNALIZER

      public static final org.infinispan.commons.marshall.AdvancedExternalizer<CompareAndSwapFunction> EXTERNALIZER
  • Constructor Details

    • CompareAndSwapFunction

      public CompareAndSwapFunction(long expect, long value)
  • Method Details