Package Summary  Overview Summary

class:AtomicBoolean [NONE]

  • All Implemented Interfaces:
    Serializable

    public class AtomicBoolean
    extends Object
    implements Serializable
    
    A boolean value that may be updated atomically. See the VarHandle specification for descriptions of the properties of atomic accesses. An AtomicBoolean is used in applications such as atomically updated flags, and cannot be used as a replacement for a Boolean.
    Since:
    1.5
    See Also:
    Serialized Form

constructor:<init>(boolean) [NONE]

  • AtomicBoolean

    public AtomicBoolean​(boolean initialValue)
    Creates a new AtomicBoolean with the given initial value.
    Parameters:
    initialValue - the initial value

constructor:<init>() [NONE]

  • AtomicBoolean

    public AtomicBoolean()
    Creates a new AtomicBoolean with initial value false.

method:get() [NONE]

method:compareAndSet(boolean,boolean) [NONE]

  • compareAndSet

    public final boolean compareAndSet​(boolean expectedValue,
                                       boolean newValue)
    Atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle.compareAndSet(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    true if successful. False return indicates that the actual value was not equal to the expected value.

method:weakCompareAndSet(boolean,boolean) [NONE]

method:weakCompareAndSetPlain(boolean,boolean) [NONE]

  • weakCompareAndSetPlain

    public boolean weakCompareAndSetPlain​(boolean expectedValue,
                                          boolean newValue)
    Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle.weakCompareAndSetPlain(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    true if successful
    Since:
    9

method:set(boolean) [NONE]

method:lazySet(boolean) [NONE]

  • lazySet

    public final void lazySet​(boolean newValue)
    Sets the value to newValue, with memory effects as specified by VarHandle.setRelease(java.lang.Object...).
    Parameters:
    newValue - the new value
    Since:
    1.6

method:getAndSet(boolean) [NONE]

  • getAndSet

    public final boolean getAndSet​(boolean newValue)
    Atomically sets the value to newValue and returns the old value, with memory effects as specified by VarHandle.getAndSet(java.lang.Object...).
    Parameters:
    newValue - the new value
    Returns:
    the previous value

method:toString() [NONE]

  • toString

    public String toString()
    Returns the String representation of the current value.
    Overrides:
    toString in class Object
    Returns:
    the String representation of the current value

method:getPlain() [NONE]

  • getPlain

    public final boolean getPlain()
    Returns the current value, with memory semantics of reading as if the variable was declared non-volatile.
    Returns:
    the value
    Since:
    9

method:setPlain(boolean) [NONE]

  • setPlain

    public final void setPlain​(boolean newValue)
    Sets the value to newValue, with memory semantics of setting as if the variable was declared non-volatile and non-final.
    Parameters:
    newValue - the new value
    Since:
    9

method:getOpaque() [NONE]

method:setOpaque(boolean) [NONE]

  • setOpaque

    public final void setOpaque​(boolean newValue)
    Sets the value to newValue, with memory effects as specified by VarHandle.setOpaque(java.lang.Object...).
    Parameters:
    newValue - the new value
    Since:
    9

method:getAcquire() [NONE]

method:setRelease(boolean) [NONE]

  • setRelease

    public final void setRelease​(boolean newValue)
    Sets the value to newValue, with memory effects as specified by VarHandle.setRelease(java.lang.Object...).
    Parameters:
    newValue - the new value
    Since:
    9

method:compareAndExchange(boolean,boolean) [NONE]

  • compareAndExchange

    public final boolean compareAndExchange​(boolean expectedValue,
                                            boolean newValue)
    Atomically sets the value to newValue if the current value, referred to as the witness value , == expectedValue , with memory effects as specified by VarHandle.compareAndExchange(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    the witness value, which will be the same as the expected value if successful
    Since:
    9

method:compareAndExchangeAcquire(boolean,boolean) [NONE]

  • compareAndExchangeAcquire

    public final boolean compareAndExchangeAcquire​(boolean expectedValue,
                                                   boolean newValue)
    Atomically sets the value to newValue if the current value, referred to as the witness value , == expectedValue , with memory effects as specified by VarHandle.compareAndExchangeAcquire(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    the witness value, which will be the same as the expected value if successful
    Since:
    9

method:compareAndExchangeRelease(boolean,boolean) [NONE]

  • compareAndExchangeRelease

    public final boolean compareAndExchangeRelease​(boolean expectedValue,
                                                   boolean newValue)
    Atomically sets the value to newValue if the current value, referred to as the witness value , == expectedValue , with memory effects as specified by VarHandle.compareAndExchangeRelease(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    the witness value, which will be the same as the expected value if successful
    Since:
    9

method:weakCompareAndSetVolatile(boolean,boolean) [NONE]

  • weakCompareAndSetVolatile

    public final boolean weakCompareAndSetVolatile​(boolean expectedValue,
                                                   boolean newValue)
    Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle.weakCompareAndSet(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    true if successful
    Since:
    9

method:weakCompareAndSetAcquire(boolean,boolean) [NONE]

  • weakCompareAndSetAcquire

    public final boolean weakCompareAndSetAcquire​(boolean expectedValue,
                                                  boolean newValue)
    Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle.weakCompareAndSetAcquire(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    true if successful
    Since:
    9

method:weakCompareAndSetRelease(boolean,boolean) [NONE]

  • weakCompareAndSetRelease

    public final boolean weakCompareAndSetRelease​(boolean expectedValue,
                                                  boolean newValue)
    Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle.weakCompareAndSetRelease(java.lang.Object...).
    Parameters:
    expectedValue - the expected value
    newValue - the new value
    Returns:
    true if successful
    Since:
    9

© 2018 Oracle Corporation and/or its affiliates