|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DistributedAtomicNumber<T>
| Method Summary | |
|---|---|
AtomicValue<T> |
add(T delta)
Add delta to the current value and return the new value information. |
AtomicValue<T> |
compareAndSet(T expectedValue,
T newValue)
Atomically sets the value to the given updated value if the current value == the expected value. |
AtomicValue<T> |
decrement()
Subtract 1 from the current value and return the new value information. |
void |
forceSet(T newValue)
Forcibly sets the value of the counter without any guarantees of atomicity. |
AtomicValue<T> |
get()
Returns the current value of the counter. |
AtomicValue<T> |
increment()
Add 1 to the current value and return the new value information. |
boolean |
initialize(T value)
Atomic values are initially set to the equivalent of NULL in a database. |
AtomicValue<T> |
subtract(T delta)
Subtract delta from the current value and return the new value information. |
AtomicValue<T> |
trySet(T newValue)
Attempt to atomically set the value to the given value. |
| Method Detail |
|---|
AtomicValue<T> get()
throws Exception
0 is returned.
Exception - ZooKeeper errors
AtomicValue<T> compareAndSet(T expectedValue,
T newValue)
throws Exception
== the expected value.
Remember to always check AtomicValue.succeeded().
expectedValue - the expected valuenewValue - the new value for the counter
Exception - ZooKeeper errors
AtomicValue<T> trySet(T newValue)
throws Exception
AtomicValue.succeeded().
newValue - the value to set
Exception - ZooKeeper errors
boolean initialize(T value)
throws Exception
NULL in a database.
Use this method to initialize the value. The value will be set if and only iff the node does not exist.
value - the initial value to set
Exception - ZooKeeper errors
void forceSet(T newValue)
throws Exception
newValue - the new value
Exception - ZooKeeper errors
AtomicValue<T> increment()
throws Exception
AtomicValue.succeeded().
Exception - ZooKeeper errors
AtomicValue<T> decrement()
throws Exception
AtomicValue.succeeded().
Exception - ZooKeeper errors
AtomicValue<T> add(T delta)
throws Exception
AtomicValue.succeeded().
delta - amount to add
Exception - ZooKeeper errors
AtomicValue<T> subtract(T delta)
throws Exception
AtomicValue.succeeded().
delta - amount to subtract
Exception - ZooKeeper errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||