Interface RAtomicLong

All Superinterfaces:
RAtomicLongAsync, RExpirable, RExpirableAsync, RObject, RObjectAsync
All Known Implementing Classes:
RedissonAtomicLong

public interface RAtomicLong extends RExpirable, RAtomicLongAsync
Distributed implementation of AtomicLong
Author:
Nikita Koksharov
  • Method Details

    • getAndDecrement

      long getAndDecrement()
      Atomically decrements by one the current value.
      Returns:
      the previous value
    • addAndGet

      long addAndGet(long delta)
      Atomically adds the given value to the current value.
      Parameters:
      delta - the value to add
      Returns:
      the updated value
    • compareAndSet

      boolean compareAndSet(long expect, long update)
      Atomically sets the value to the given updated value only if the current value == the expected value.
      Parameters:
      expect - the expected value
      update - the new value
      Returns:
      true if successful; or false if the actual value was not equal to the expected value.
    • decrementAndGet

      long decrementAndGet()
      Atomically decrements the current value by one.
      Returns:
      the updated value
    • get

      long get()
      Returns current value.
      Returns:
      the current value
    • getAndDelete

      long getAndDelete()
      Gets and deletes object
      Returns:
      the current value
    • getAndAdd

      long getAndAdd(long delta)
      Atomically adds the given value to the current value.
      Parameters:
      delta - the value to add
      Returns:
      the old value before the add
    • getAndSet

      long getAndSet(long newValue)
      Atomically sets the given value and returns the old value.
      Parameters:
      newValue - the new value
      Returns:
      the old value
    • incrementAndGet

      long incrementAndGet()
      Atomically increments the current value by one.
      Returns:
      the updated value
    • getAndIncrement

      long getAndIncrement()
      Atomically increments the current value by one.
      Returns:
      the old value
    • set

      void set(long newValue)
      Atomically sets the given value.
      Parameters:
      newValue - the new value
    • addListener

      int addListener(ObjectListener listener)
      Adds object event listener
      Specified by:
      addListener in interface RObject
      Parameters:
      listener - object event listener
      Returns:
      listener id
      See Also: