Package org.redisson.api
Interface RAtomicLong
-
- All Superinterfaces:
RAtomicLongAsync
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
- All Known Implementing Classes:
RedissonAtomicLong
public interface RAtomicLong extends RExpirable, RAtomicLongAsync
Distributed implementation ofAtomicLong
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
addAndGet(long delta)
Atomically adds the given value to the current value.boolean
compareAndSet(long expect, long update)
Atomically sets the value to the given updated value only if the current value==
the expected value.long
decrementAndGet()
Atomically decrements the current value by one.long
get()
Returns current value.long
getAndAdd(long delta)
Atomically adds the given value to the current value.long
getAndDecrement()
Atomically decrements by one the current value.long
getAndDelete()
Gets and deletes objectlong
getAndIncrement()
Atomically increments the current value by one.long
getAndSet(long newValue)
Atomically sets the given value and returns the old value.long
incrementAndGet()
Atomically increments the current value by one.void
set(long newValue)
Atomically sets the given value.-
Methods inherited from interface org.redisson.api.RAtomicLongAsync
addAndGetAsync, compareAndSetAsync, decrementAndGetAsync, getAndAddAsync, getAndDecrementAsync, getAndDeleteAsync, getAndIncrementAsync, getAndSetAsync, getAsync, incrementAndGetAsync, setAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
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 valueupdate
- 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
-
-