Class AtomicBoolean
- java.lang.Object
-
- org.zeroturnaround.javarebel.integration.support.AtomicBoolean
-
public class AtomicBoolean extends Object
A boolean value that may be updated atomically.- Author:
- Rein Raudjärv
-
-
Constructor Summary
Constructors Constructor Description AtomicBoolean(boolean initialValue)Creates a new AtomicBoolean with the given initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompareAndSet(boolean expect, boolean update)Atomically set the value to the given updated value if the current value == the expected value.booleanget()Returns the current value.voidset(boolean value)Unconditionally sets to the given value.
-
-
-
Method Detail
-
get
public boolean get()
Returns the current value.- Returns:
- the current value
-
set
public void set(boolean value)
Unconditionally sets to the given value.- Parameters:
newValue- the new value
-
compareAndSet
public boolean compareAndSet(boolean expect, boolean update)Atomically set the value to the given updated value if the current value == the expected value.- Parameters:
expect- the expected valueupdate- the new value- Returns:
- true if successful. False return indicates that the actual value was not equal to the expected value.
-
-