Class AtomicLongAdapter

java.lang.Object
com.axelor.cache.caffeine.AtomicLongAdapter
All Implemented Interfaces:
DistributedAtomicLong

public class AtomicLongAdapter extends Object implements DistributedAtomicLong
Adapter class for AtomicLong to conform to the DistributedAtomicLong interface.
  • Constructor Details

    • AtomicLongAdapter

      public AtomicLongAdapter(AtomicLong 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 AtomicLong getUnderlyingAtomicLong()
      Description copied from interface: DistributedAtomicLong
      Returns underlying atomic long.
      Specified by:
      getUnderlyingAtomicLong in interface DistributedAtomicLong