Class LocalAtomicBoolean

java.lang.Object
com.oracle.coherence.concurrent.atomic.LocalAtomicBoolean
All Implemented Interfaces:
AtomicBoolean

public class LocalAtomicBoolean extends Object implements AtomicBoolean
Local implementation of AtomicBoolean interface, that simply wraps java.util.concurrent.atomic.AtomicBoolean instance.
Since:
21.12
Author:
Aleks Seovic 2020.12.07
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.oracle.coherence.concurrent.atomic.AtomicBoolean

    AtomicBoolean.Serializer
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    LocalAtomicBoolean(boolean fValue)
    Construct LocalAtomicBoolean instance.
    protected
    Construct LocalAtomicBoolean instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return non-blocking API for this atomic value.
    boolean
    compareAndExchange(boolean fExpectedValue, boolean fNewValue)
    Atomically sets the value to newValue if the current value, referred to as the witness value, == expectedValue.
    boolean
    compareAndSet(boolean fExpectedValue, boolean fNewValue)
    Atomically sets the value to newValue if the current value == expectedValue.
    boolean
    get()
    Returns the current value.
    boolean
    getAndSet(boolean fNewValue)
    Atomically sets the value to newValue and returns the old value.
    void
    set(boolean fNewValue)
    Sets the value to newValue.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LocalAtomicBoolean

      protected LocalAtomicBoolean(boolean fValue)
      Construct LocalAtomicBoolean instance.
      Parameters:
      fValue - initial value
    • LocalAtomicBoolean

      protected LocalAtomicBoolean(AtomicBoolean fValue)
      Construct LocalAtomicBoolean instance.
      Parameters:
      fValue - wrapped value
  • Method Details

    • async

      public AsyncLocalAtomicBoolean async()
      Description copied from interface: AtomicBoolean
      Return non-blocking API for this atomic value.
      Specified by:
      async in interface AtomicBoolean
      Returns:
      non-blocking API for this atomic value
    • get

      public boolean get()
      Description copied from interface: AtomicBoolean
      Returns the current value.
      Specified by:
      get in interface AtomicBoolean
      Returns:
      the current value
    • set

      public void set(boolean fNewValue)
      Description copied from interface: AtomicBoolean
      Sets the value to newValue.
      Specified by:
      set in interface AtomicBoolean
      Parameters:
      fNewValue - the new value
    • getAndSet

      public boolean getAndSet(boolean fNewValue)
      Description copied from interface: AtomicBoolean
      Atomically sets the value to newValue and returns the old value.
      Specified by:
      getAndSet in interface AtomicBoolean
      Parameters:
      fNewValue - the new value
      Returns:
      the previous value
    • compareAndSet

      public boolean compareAndSet(boolean fExpectedValue, boolean fNewValue)
      Description copied from interface: AtomicBoolean
      Atomically sets the value to newValue if the current value == expectedValue.
      Specified by:
      compareAndSet in interface AtomicBoolean
      Parameters:
      fExpectedValue - the expected value
      fNewValue - the new value
      Returns:
      true if successful. False return indicates that the actual value was not equal to the expected value.
    • compareAndExchange

      public boolean compareAndExchange(boolean fExpectedValue, boolean fNewValue)
      Description copied from interface: AtomicBoolean
      Atomically sets the value to newValue if the current value, referred to as the witness value, == expectedValue.
      Specified by:
      compareAndExchange in interface AtomicBoolean
      Parameters:
      fExpectedValue - the expected value
      fNewValue - the new value
      Returns:
      the witness value, which will be the same as the expected value if successful
    • toString

      public String toString()
      Overrides:
      toString in class Object