Package org.redisson
Class RedissonAtomicDouble
java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonAtomicDouble
- All Implemented Interfaces:
RAtomicDouble
,RAtomicDoubleAsync
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
Distributed alternative to the
AtomicLong
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
addAndGet
(double delta) Atomically adds the given value to the current value.addAndGetAsync
(double delta) Atomically adds the given value to the current value.int
addListener
(ObjectListener listener) Adds object event listeneraddListenerAsync
(ObjectListener listener) Adds object event listenerboolean
Clear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync
(String... keys) boolean
compareAndSet
(double expect, double update) Atomically sets the value to the given updated value only if the current value==
the expected value.compareAndSetAsync
(double expect, double update) Atomically sets the value to the given updated value only if the current value==
the expected value.double
Atomically decrements the current value by one.Atomically decrements the current value by one.boolean
UseRExpirable.expire(Duration)
insteadboolean
Sets a timeout for this object.boolean
Sets an expiration date for this object.expireAsync
(long timeToLive, TimeUnit timeUnit) UseRExpirableAsync.expireAsync(Duration)
insteadexpireAsync
(long timeToLive, TimeUnit timeUnit, String param, String... keys) expireAsync
(Duration duration) Set a timeout for object.expireAsync
(Instant instant) Set an expire date for object.boolean
expireAt
(long timestamp) UseRExpirable.expire(Instant)
insteadboolean
UseRExpirable.expire(Instant)
insteadexpireAtAsync
(long timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadexpireAtAsync
(long timestamp, String param, String... keys) expireAtAsync
(Date timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadboolean
expireIfGreater
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.boolean
expireIfGreater
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.expireIfGreaterAsync
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.expireIfGreaterAsync
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.boolean
expireIfLess
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.boolean
expireIfLess
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.expireIfLessAsync
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.expireIfLessAsync
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.boolean
expireIfNotSet
(Duration duration) Sets a timeout for this object only if it hasn't been set before.boolean
expireIfNotSet
(Instant time) Sets an expiration date for this object only if it hasn't been set before.expireIfNotSetAsync
(Duration duration) Sets a timeout for this object only if it hasn't been set before.expireIfNotSetAsync
(Instant time) Sets an expiration date for this object only if it hasn't been set before.boolean
expireIfSet
(Duration duration) Sets a timeout for this object only if it has been already set.boolean
expireIfSet
(Instant time) Sets an expiration date for this object only if it has been already set.expireIfSetAsync
(Duration duration) Sets a timeout for this object only if it has been already set.expireIfSetAsync
(Instant time) Sets an expiration date for this object only if it has been already set.double
get()
Returns current value.double
getAndAdd
(double delta) Atomically adds the given value to the current value.getAndAddAsync
(double delta) Atomically adds the given value to the current value.double
Atomically decrements by one the current value.Atomically decrements by one the current value.double
Returns and deletes objectReturns and deletes objectdouble
Atomically increments the current value by one.Atomically increments the current value by one.double
getAndSet
(double newValue) Atomically sets the given value and returns the old value.getAndSetAsync
(double newValue) Atomically sets the given value and returns the old value.getAsync()
Returns current value.long
Expiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutdouble
Atomically increments the current value by one.Atomically increments the current value by one.long
Remaining time to live of Redisson object that has a timeoutRemaining time to live of Redisson object that has a timeoutvoid
removeListener
(int listenerId) Removes object event listenerremoveListenerAsync
(int listenerId) Removes object event listenervoid
set
(double newValue) Atomically sets the given value.setAsync
(double newValue) Atomically sets the given value.toString()
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, addTrackingListener, addTrackingListenerAsync, copy, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenerAsync, removeTrackingListener, removeTrackingListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Constructor Details
-
RedissonAtomicDouble
-
-
Method Details
-
addAndGet
public double addAndGet(double delta) Description copied from interface:RAtomicDouble
Atomically adds the given value to the current value.- Specified by:
addAndGet
in interfaceRAtomicDouble
- Parameters:
delta
- the value to add- Returns:
- the updated value
-
addAndGetAsync
Description copied from interface:RAtomicDoubleAsync
Atomically adds the given value to the current value.- Specified by:
addAndGetAsync
in interfaceRAtomicDoubleAsync
- Parameters:
delta
- the value to add- Returns:
- the updated value
-
compareAndSet
public boolean compareAndSet(double expect, double update) Description copied from interface:RAtomicDouble
Atomically sets the value to the given updated value only if the current value==
the expected value.- Specified by:
compareAndSet
in interfaceRAtomicDouble
- 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.
-
compareAndSetAsync
Description copied from interface:RAtomicDoubleAsync
Atomically sets the value to the given updated value only if the current value==
the expected value.- Specified by:
compareAndSetAsync
in interfaceRAtomicDoubleAsync
- 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
public double decrementAndGet()Description copied from interface:RAtomicDouble
Atomically decrements the current value by one.- Specified by:
decrementAndGet
in interfaceRAtomicDouble
- Returns:
- the updated value
-
decrementAndGetAsync
Description copied from interface:RAtomicDoubleAsync
Atomically decrements the current value by one.- Specified by:
decrementAndGetAsync
in interfaceRAtomicDoubleAsync
- Returns:
- the updated value
-
get
public double get()Description copied from interface:RAtomicDouble
Returns current value.- Specified by:
get
in interfaceRAtomicDouble
- Returns:
- current value
-
getAndDelete
public double getAndDelete()Description copied from interface:RAtomicDouble
Returns and deletes object- Specified by:
getAndDelete
in interfaceRAtomicDouble
- Returns:
- the current value
-
getAndDeleteAsync
Description copied from interface:RAtomicDoubleAsync
Returns and deletes object- Specified by:
getAndDeleteAsync
in interfaceRAtomicDoubleAsync
- Returns:
- the current value
-
getAsync
Description copied from interface:RAtomicDoubleAsync
Returns current value.- Specified by:
getAsync
in interfaceRAtomicDoubleAsync
- Returns:
- current value
-
getAndAdd
public double getAndAdd(double delta) Description copied from interface:RAtomicDouble
Atomically adds the given value to the current value.- Specified by:
getAndAdd
in interfaceRAtomicDouble
- Parameters:
delta
- the value to add- Returns:
- the old value before the add
-
getAndAddAsync
Description copied from interface:RAtomicDoubleAsync
Atomically adds the given value to the current value.- Specified by:
getAndAddAsync
in interfaceRAtomicDoubleAsync
- Parameters:
delta
- the value to add- Returns:
- the updated value
-
getAndSet
public double getAndSet(double newValue) Description copied from interface:RAtomicDouble
Atomically sets the given value and returns the old value.- Specified by:
getAndSet
in interfaceRAtomicDouble
- Parameters:
newValue
- the new value- Returns:
- the old value
-
getAndSetAsync
Description copied from interface:RAtomicDoubleAsync
Atomically sets the given value and returns the old value.- Specified by:
getAndSetAsync
in interfaceRAtomicDoubleAsync
- Parameters:
newValue
- the new value- Returns:
- the old value
-
incrementAndGet
public double incrementAndGet()Description copied from interface:RAtomicDouble
Atomically increments the current value by one.- Specified by:
incrementAndGet
in interfaceRAtomicDouble
- Returns:
- the updated value
-
incrementAndGetAsync
Description copied from interface:RAtomicDoubleAsync
Atomically increments the current value by one.- Specified by:
incrementAndGetAsync
in interfaceRAtomicDoubleAsync
- Returns:
- the updated value
-
getAndIncrement
public double getAndIncrement()Description copied from interface:RAtomicDouble
Atomically increments the current value by one.- Specified by:
getAndIncrement
in interfaceRAtomicDouble
- Returns:
- the old value
-
getAndIncrementAsync
Description copied from interface:RAtomicDoubleAsync
Atomically increments the current value by one.- Specified by:
getAndIncrementAsync
in interfaceRAtomicDoubleAsync
- Returns:
- the old value
-
getAndDecrement
public double getAndDecrement()Description copied from interface:RAtomicDouble
Atomically decrements by one the current value.- Specified by:
getAndDecrement
in interfaceRAtomicDouble
- Returns:
- the previous value
-
getAndDecrementAsync
Description copied from interface:RAtomicDoubleAsync
Atomically decrements by one the current value.- Specified by:
getAndDecrementAsync
in interfaceRAtomicDoubleAsync
- Returns:
- the previous value
-
set
public void set(double newValue) Description copied from interface:RAtomicDouble
Atomically sets the given value.- Specified by:
set
in interfaceRAtomicDouble
- Parameters:
newValue
- the new value
-
setAsync
Description copied from interface:RAtomicDoubleAsync
Atomically sets the given value.- Specified by:
setAsync
in interfaceRAtomicDoubleAsync
- Parameters:
newValue
- the new value- Returns:
- void
-
toString
-
addListener
Description copied from interface:RObject
Adds object event listener- Specified by:
addListener
in interfaceRAtomicDouble
- Specified by:
addListener
in interfaceRObject
- Overrides:
addListener
in classRedissonObject
- Parameters:
listener
- - object event listener- Returns:
- listener id
- See Also:
-
addListenerAsync
Description copied from interface:RObjectAsync
Adds object event listener- Specified by:
addListenerAsync
in interfaceRAtomicDoubleAsync
- Specified by:
addListenerAsync
in interfaceRObjectAsync
- Overrides:
addListenerAsync
in classRedissonObject
- Parameters:
listener
- - object event listener- Returns:
- listener id
- See Also:
-
removeListener
public void removeListener(int listenerId) Description copied from interface:RObject
Removes object event listener- Specified by:
removeListener
in interfaceRObject
- Overrides:
removeListener
in classRedissonObject
- Parameters:
listenerId
- - listener id
-
removeListenerAsync
Description copied from interface:RObjectAsync
Removes object event listener- Specified by:
removeListenerAsync
in interfaceRObjectAsync
- Overrides:
removeListenerAsync
in classRedissonObject
- Parameters:
listenerId
- - listener id
-
expire
Description copied from interface:RExpirable
UseRExpirable.expire(Duration)
instead- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Duration)
instead- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp) Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expire
Description copied from interface:RExpirable
Sets an expiration date for this object. When expire date comes the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
instant
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
instant
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expire
Description copied from interface:RExpirable
Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
clearExpireAsync
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
remainTimeToLive
public long remainTimeToLive()Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in interfaceRExpirable
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
Description copied from interface:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
getExpireTime
public long getExpireTime()Description copied from interface:RExpirable
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTime
in interfaceRExpirable
- Returns:
- expiration time
-
getExpireTimeAsync
Description copied from interface:RExpirableAsync
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsync
in interfaceRExpirableAsync
- Returns:
- expiration time
-
expireAsync
-
expireAtAsync
-
clearExpireAsync
-