org.mapdb
Class Atomic.Boolean

java.lang.Object
  extended by org.mapdb.Atomic.Boolean
Enclosing class:
Atomic

public static final class Atomic.Boolean
extends Object

A boolean record that may be updated atomically.


Field Summary
protected  Engine engine
           
protected  long recid
           
 
Constructor Summary
Atomic.Boolean(Engine engine, long recid)
           
 
Method Summary
 boolean compareAndSet(boolean expect, boolean update)
          Atomically sets the value to the given updated value if the current value == the expected value.
 boolean get()
          Returns the current value.
 boolean getAndSet(boolean newValue)
          Atomically sets to the given value and returns the previous value.
 long getRecid()
           
 void set(boolean newValue)
          Unconditionally sets to the given value.
 String toString()
          Returns the String representation of the current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

engine

protected final Engine engine

recid

protected final long recid
Constructor Detail

Atomic.Boolean

public Atomic.Boolean(Engine engine,
                      long recid)
Method Detail

getRecid

public long getRecid()
Returns:
recid under which value is saved

get

public final boolean get()
Returns the current value.

Returns:
the current value

compareAndSet

public final boolean compareAndSet(boolean expect,
                                   boolean update)
Atomically sets the value to the given updated value if the current value == the expected value.

Parameters:
expect - the expected value
update - the new value
Returns:
true if successful. False return indicates that the actual value was not equal to the expected value.

set

public final void set(boolean newValue)
Unconditionally sets to the given value.

Parameters:
newValue - the new value

getAndSet

public final boolean getAndSet(boolean newValue)
Atomically sets to the given value and returns the previous value.

Parameters:
newValue - the new value
Returns:
the previous value

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.


Copyright © 2014. All Rights Reserved.