Class AsyncCounterImpl

java.lang.Object
org.jgroups.raft.blocks.AsyncCounterImpl
All Implemented Interfaces:
org.jgroups.blocks.atomic.AsyncCounter, org.jgroups.blocks.atomic.BaseCounter, RaftAsyncCounter, RaftCounter

public class AsyncCounterImpl extends Object implements RaftAsyncCounter
RAFT Implementation of AsyncCounter.
Since:
1.0.9
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.jgroups.blocks.atomic.BaseCounter
    • get

      public CompletionStage<Long> get()
      Specified by:
      get in interface org.jgroups.blocks.atomic.AsyncCounter
    • getLocal

      public long getLocal()
      Description copied from interface: RaftCounter
      Gets the current local value of the counter; this is purely local and the value may be stale
      Specified by:
      getLocal in interface RaftCounter
      Returns:
      The current local value of the counter
    • set

      public CompletionStage<Void> set(long new_value)
      Specified by:
      set in interface org.jgroups.blocks.atomic.AsyncCounter
    • compareAndSwap

      public CompletionStage<Long> compareAndSwap(long expect, long update)
      Specified by:
      compareAndSwap in interface org.jgroups.blocks.atomic.AsyncCounter
    • addAndGet

      public CompletionStage<Long> addAndGet(long delta)
      Specified by:
      addAndGet in interface org.jgroups.blocks.atomic.AsyncCounter
    • update

      public <T extends org.jgroups.util.Streamable> CompletionStage<T> update(org.jgroups.blocks.atomic.CounterFunction<T> updateFunction)
      Specified by:
      update in interface org.jgroups.blocks.atomic.AsyncCounter
    • sync

      public RaftSyncCounter sync()
      Specified by:
      sync in interface org.jgroups.blocks.atomic.BaseCounter
      Specified by:
      sync in interface RaftCounter
    • async

      public RaftAsyncCounter async()
      Specified by:
      async in interface org.jgroups.blocks.atomic.AsyncCounter
      Specified by:
      async in interface org.jgroups.blocks.atomic.BaseCounter
      Specified by:
      async in interface RaftAsyncCounter
      Specified by:
      async in interface RaftCounter
    • withOptions

      public RaftAsyncCounter withOptions(Options opts)
      Description copied from interface: RaftCounter
      Returns an instance of a counter with the given options
      Specified by:
      withOptions in interface RaftAsyncCounter
      Specified by:
      withOptions in interface RaftCounter
      Parameters:
      opts - The options
      Returns:
      The counter of the given type
    • toString

      public String toString()
      Overrides:
      toString in class Object