java.lang.Object | |
↳ | java.util.concurrent.atomic.AtomicBoolean |
A boolean value that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables. An AtomicBoolean is used in applications such as atomically updated flags, and cannot be used as a replacement for a Boolean.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new AtomicBoolean with the given initial value.
| |||||||||||
Creates a new AtomicBoolean with initial value false.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Atomically sets the value to the given update value if the
current value is equal to the expected value.
| |||||||||||
Returns the current value.
| |||||||||||
Sets to the given value and returns the previous value.
| |||||||||||
Unconditionally sets to the given value.
| |||||||||||
Returns the String representation of the current value.
| |||||||||||
Atomically set the value to the given updated value
if the current value == the expected value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Creates a new AtomicBoolean with the given initial value.
initialValue | the initial value |
---|
Creates a new AtomicBoolean with initial value false.
Atomically sets the value to the given update value if the current value is equal to the expected value. Any given invocation of this operation may fail (return false) spuriously, but repeated invocation when the current value holds the expected value and no other thread is also attempting to set the value will eventually succeed.
expect | the expected value |
---|---|
update | the new value |
Returns the current value.
Sets to the given value and returns the previous value.
newValue | the new value |
---|
Unconditionally sets to the given value.
newValue | the new value |
---|
Returns the String representation of the current value.
Atomically set the value to the given updated value if the current value == the expected value. May fail spuriously.
expect | the expected value |
---|---|
update | the new value |