org.mapdb
Class Atomic.String

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

public static final class Atomic.String
extends Object

A String record that may be updated atomically.


Field Summary
protected  Engine engine
           
protected  long recid
           
 
Constructor Summary
Atomic.String(Engine engine, long recid)
           
 
Method Summary
 boolean compareAndSet(String expect, String update)
          Atomically sets the value to the given updated value if the current value equals the expected value.
 String get()
          Returns the current value.
 String getAndSet(String newValue)
          Atomically sets to the given value and returns the previous value.
 long getRecid()
           
 void set(String newValue)
          Unconditionally sets to the given value.
 String toString()
           
 
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.String

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

getRecid

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

toString

public String toString()
Overrides:
toString in class Object

get

public final String get()
Returns the current value.

Returns:
the current value

compareAndSet

public final boolean compareAndSet(String expect,
                                   String update)
Atomically sets the value to the given updated value if the current value equals 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(String newValue)
Unconditionally sets to the given value.

Parameters:
newValue - the new value

getAndSet

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

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


Copyright © 2014. All Rights Reserved.