org.terracotta.util
Interface ClusteredAtomicLong

All Known Implementing Classes:
TerracottaAtomicLong

public interface ClusteredAtomicLong

A long value that may updated atomically across the cluster.


Method Summary
 long addAndGet(long delta)
          Atomically add the supplied value to the current value.
 byte byteValue()
          Number.byteValue()
 boolean compareAndSet(long expect, long update)
          Atomically set the value to the new value if the current value == the given value.
 long decrementAndGet()
          Atomically decrement the current value.
 double doubleValue()
          Number.doubleValue()
 float floatValue()
          Number.floatValue()
 long get()
          Get the current value.
 long getAndAdd(long delta)
          Atomically add the supplied value to the current value.
 long getAndDecrement()
          Atomically decrement the current value.
 long getAndIncrement()
          Atomically increment the current value.
 long getAndSet(long newValue)
          Atomically: set to the given value and return the previous value.
 long incrementAndGet()
          Atomically increment the current value
 int intValue()
          Number.intValue()
 long longValue()
          Number.longValue()
 void set(long newValue)
          Set to the given value
 short shortValue()
          Number.shortValue()
 String toString()
           
 boolean weakCompareAndSet(long expect, long update)
          Atomically set the value to the new value if the current value == the given value.
 

Method Detail

addAndGet

long addAndGet(long delta)
Atomically add the supplied value to the current value.

Parameters:
delta - the value to add
Returns:
the new value

compareAndSet

boolean compareAndSet(long expect,
                      long update)
Atomically set the value to the new value if the current value == the given value.

Parameters:
expect - the expected value
update - the new value
Returns:
true if successful, false if the comparison failed

decrementAndGet

long decrementAndGet()
Atomically decrement the current value.

Returns:
the new value

get

long get()
Get the current value.

Returns:
the current value

getAndAdd

long getAndAdd(long delta)
Atomically add the supplied value to the current value.

Parameters:
delta - the value to add
Returns:
the previous value

getAndDecrement

long getAndDecrement()
Atomically decrement the current value.

Returns:
the previous value

getAndIncrement

long getAndIncrement()
Atomically increment the current value.

Returns:
the previous value

getAndSet

long getAndSet(long newValue)
Atomically: set to the given value and return the previous value.

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

incrementAndGet

long incrementAndGet()
Atomically increment the current value

Returns:
the new value

set

void set(long newValue)
Set to the given value

Parameters:
newValue - the new value

weakCompareAndSet

boolean weakCompareAndSet(long expect,
                          long update)
Atomically set the value to the new value if the current value == the given value.

May fail spuriously. Repeated uncontended valid calls will eventually succeed however.

Parameters:
expect - the expected value
update - the new value
Returns:
true if successful, false if the comparison failed

byteValue

byte byteValue()
Number.byteValue()


shortValue

short shortValue()
Number.shortValue()


intValue

int intValue()
Number.intValue()


longValue

long longValue()
Number.longValue()


floatValue

float floatValue()
Number.floatValue()


doubleValue

double doubleValue()
Number.doubleValue()


toString

String toString()
Overrides:
toString in class Object


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.