Class CompareAndSwapFunction<K extends CounterKey>

  • 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 Detail

      • EXTERNALIZER

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

      • CompareAndSwapFunction

        public CompareAndSwapFunction​(long expect,
                                      long value)
    • Method Detail

      • getLog

        protected Log getLog()
      • apply

        public final R apply​(org.infinispan.functional.EntryView.ReadWriteEntryView<K,​CounterValue> entryView)
        Specified by:
        apply in interface Function<K extends CounterKey,​R>