Class RedissonAtomicLongAdapter

java.lang.Object
com.axelor.cache.redisson.RedissonAtomicLongAdapter
All Implemented Interfaces:
DistributedAtomicLong

public class RedissonAtomicLongAdapter extends Object implements DistributedAtomicLong
Adapter class for RAtomicLong to conform to the DistributedAtomicLong interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedissonAtomicLongAdapter(org.redisson.api.RAtomicLong atomicLong)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    addAndGet(long delta)
    Atomically adds the given value to the current value.
    boolean
    compareAndSet(long expectedValue, long newValue)
    Atomically sets the value to newValue if the current value == expectedValue.
    long
    Atomically decrements the current value.
    long
    get()
    Returns the current value.
    long
    getAndAdd(long delta)
    Atomically increments the current value.
    long
    Atomically decrements the current value.
    long
    Atomically increments the current value.
    long
    getAndSet(long newValue)
    Atomically sets the value to newValue and returns the old value.
    org.redisson.api.RAtomicLong
    Returns underlying atomic long.
    long
    Atomically increments the current value by one.
    void
    set(long newValue)
    Sets the value to newValue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RedissonAtomicLongAdapter

      public RedissonAtomicLongAdapter(org.redisson.api.RAtomicLong atomicLong)
  • Method Details

    • get

      public long get()
      Description copied from interface: DistributedAtomicLong
      Returns the current value.
      Specified by:
      get in interface DistributedAtomicLong
      Returns:
      the current value
    • set

      public void set(long newValue)
      Description copied from interface: DistributedAtomicLong
      Sets the value to newValue.
      Specified by:
      set in interface DistributedAtomicLong
      Parameters:
      newValue - the new value
    • getAndSet

      public long getAndSet(long newValue)
      Description copied from interface: DistributedAtomicLong
      Atomically sets the value to newValue and returns the old value.
      Specified by:
      getAndSet in interface DistributedAtomicLong
      Parameters:
      newValue - the new value
      Returns:
      the previous value
    • compareAndSet

      public boolean compareAndSet(long expectedValue, long newValue)
      Description copied from interface: DistributedAtomicLong
      Atomically sets the value to newValue if the current value == expectedValue.
      Specified by:
      compareAndSet in interface DistributedAtomicLong
      Parameters:
      expectedValue - the expected value
      newValue - the new value
      Returns:
      true if successful. False return indicates that the actual value was not equal to the expected value.
    • getAndIncrement

      public long getAndIncrement()
      Description copied from interface: DistributedAtomicLong
      Atomically increments the current value.

      Equivalent to addAndGet(1).

      Specified by:
      getAndIncrement in interface DistributedAtomicLong
      Returns:
      the updated value
    • getAndDecrement

      public long getAndDecrement()
      Description copied from interface: DistributedAtomicLong
      Atomically decrements the current value.
      Specified by:
      getAndDecrement in interface DistributedAtomicLong
      Returns:
      the previous value
    • getAndAdd

      public long getAndAdd(long delta)
      Description copied from interface: DistributedAtomicLong
      Atomically increments the current value.

      Equivalent to addAndGet(1).

      Specified by:
      getAndAdd in interface DistributedAtomicLong
      Returns:
      the updated value
    • incrementAndGet

      public long incrementAndGet()
      Description copied from interface: DistributedAtomicLong
      Atomically increments the current value by one.
      Specified by:
      incrementAndGet in interface DistributedAtomicLong
      Returns:
      the updated value (value after incrementing)
    • decrementAndGet

      public long decrementAndGet()
      Description copied from interface: DistributedAtomicLong
      Atomically decrements the current value.

      Equivalent to addAndGet(-1).

      Specified by:
      decrementAndGet in interface DistributedAtomicLong
      Returns:
      the updated value
    • addAndGet

      public long addAndGet(long delta)
      Description copied from interface: DistributedAtomicLong
      Atomically adds the given value to the current value.
      Specified by:
      addAndGet in interface DistributedAtomicLong
      Parameters:
      delta - the value to add
      Returns:
      the updated value
    • getUnderlyingAtomicLong

      public org.redisson.api.RAtomicLong getUnderlyingAtomicLong()
      Description copied from interface: DistributedAtomicLong
      Returns underlying atomic long.
      Specified by:
      getUnderlyingAtomicLong in interface DistributedAtomicLong