Package com.axelor.cache.redisson
Class RedissonAtomicLongAdapter
java.lang.Object
com.axelor.cache.redisson.RedissonAtomicLongAdapter
- All Implemented Interfaces:
DistributedAtomicLong
Adapter class for
RAtomicLong
to conform to the DistributedAtomicLong
interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
addAndGet
(long delta) Atomically adds the given value to the current value.boolean
compareAndSet
(long expectedValue, long newValue) Atomically sets the value tonewValue
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 tonewValue
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 tonewValue
.
-
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 interfaceDistributedAtomicLong
- Returns:
- the current value
-
set
public void set(long newValue) Description copied from interface:DistributedAtomicLong
Sets the value tonewValue
.- Specified by:
set
in interfaceDistributedAtomicLong
- Parameters:
newValue
- the new value
-
getAndSet
public long getAndSet(long newValue) Description copied from interface:DistributedAtomicLong
Atomically sets the value tonewValue
and returns the old value.- Specified by:
getAndSet
in interfaceDistributedAtomicLong
- 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 tonewValue
if the current value== expectedValue
.- Specified by:
compareAndSet
in interfaceDistributedAtomicLong
- Parameters:
expectedValue
- the expected valuenewValue
- 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 interfaceDistributedAtomicLong
- Returns:
- the updated value
-
getAndDecrement
public long getAndDecrement()Description copied from interface:DistributedAtomicLong
Atomically decrements the current value.- Specified by:
getAndDecrement
in interfaceDistributedAtomicLong
- 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 interfaceDistributedAtomicLong
- Returns:
- the updated value
-
incrementAndGet
public long incrementAndGet()Description copied from interface:DistributedAtomicLong
Atomically increments the current value by one.- Specified by:
incrementAndGet
in interfaceDistributedAtomicLong
- 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 interfaceDistributedAtomicLong
- 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 interfaceDistributedAtomicLong
- 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 interfaceDistributedAtomicLong
-