Alias for set()
.
Alias for set()
. Updates the current value.
will be the new value returned by get()
the current value persisted by this Atomic, an alias for get()
Does a compare-and-set operation on the current value.
Does a compare-and-set operation on the current value. For more info, checkout the related Compare-and-swap Wikipedia page.
It's an atomic, worry free operation.
is the value you expect to be persisted when the operation happens
will be the new value, should the check for expect
succeeds
either true in case the operation succeeded or false otherwise
Decrements this number until it reaches zero.
Decrements this number until it reaches zero.
a number representing how much it was able to subtract, which
is a value between zero and v
the current value persisted by this Atomic
Sets the persisted value to update
and returns the old value that was in place.
Sets the persisted value to update
and returns the old value that was in place.
It's an atomic, worry free operation.
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
the old value, just prior to when the successful update happened
Eventually sets to the given value.
Eventually sets to the given value. Has weaker visibility guarantees than the normal set()
.
Updates the current value.
Updates the current value.
will be the new value returned by get()
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by your callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns a tuple that specifies the update + what should this method return when the operation succeeds.
whatever was specified by your callback, once the operation succeeds
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
whatever the update is, after the operation succeeds
Alias for set()
.
Alias for set()
. Updates the current value.
will be the new value returned by get()
Waits until the compareAndSet
operation succeeds, e.g...
Waits until the compareAndSet
operation succeeds, e.g...
1. until the old value == expected and the operation succeeds, or
2. until the current thread is interrupted, or
3. the specified timeout is due
So this can throw an exception on timeout, useful for when you want to insure that you don't block the current thread ad infinitum
specifies the timeout, after which this method throws a TimeoutException
Waits until the compareAndSet
operation succeeds, e.g...
Waits until the compareAndSet
operation succeeds, e.g...
1. until the old value == expected and the operation succeeds, or
2. until the current thread is interrupted
3. until the the spin lock retried for a maximum of maxRetries
the expected current value
the value to replace the current value
the maximum number of times to retry in case of failure
true if the operation succeeded or false in case it failed after
it retried for maxRetries
times
Waits until the compareAndSet
operation succeeds, e.g...
Waits until the compareAndSet
operation succeeds, e.g...
1. until the old value == expected and the operation succeeds, or
2. until the current thread is interrupted
Waits until the specified callback, that receives the current value, returns true
.
Waits until the specified callback, that receives the current value, returns true
.
Throws a TimeoutException
in case the specified waitAtMost
timeout is due.
Waits until the specified callback, that receives the current value, returns true
.
Waits until the specified callback, that receives the current value, returns true
.
Waits until the specified expect
value == the value stored by this Atomic reference
or until the current thread gets interrupted.
Waits until the specified expect
value == the value stored by this Atomic reference
or until the current thread gets interrupted.
This can throw an exception on timeout, useful for when you want to insure that you don't block the current thread ad infinitum
specifies the timeout, after which this method throws a TimeoutException
Waits until the specified expect
value == the value stored by this Atomic reference
or until the current thread gets interrupted.
Waits until the specified expect
value == the value stored by this Atomic reference
or until the current thread gets interrupted.