EDU.oswego.cs.dl.util.concurrent
Class WaitableLong
public
class
WaitableLong
extends SynchronizedLong
Constructor Summary |
| WaitableLong(long initialValue)
Make a new WaitableLong with the given initial value,
and using its own internal lock.
|
| WaitableLong(long initialValue, Object lock)
Make a new WaitableLong with the given initial value,
and using the supplied lock.
|
Method Summary |
long | add(long amount) |
long | and(long b)
Set value to value & b. |
boolean | commit(long assumedValue, long newValue) |
long | complement()
Set the value to its complement |
long | decrement() |
long | divide(long factor) |
long | increment() |
long | multiply(long factor) |
long | or(long b)
Set value to value | b. |
long | set(long newValue) |
long | subtract(long amount) |
void | whenEqual(long c, Runnable action)
Wait until value equals c, then run action if nonnull.
|
void | whenGreater(long c, Runnable action)
wait until value greater than c, then run action if nonnull.
|
void | whenGreaterEqual(long c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
|
void | whenLess(long c, Runnable action)
wait until value less than c, then run action if nonnull.
|
void | whenLessEqual(long c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
|
void | whenNotEqual(long c, Runnable action)
wait until value not equal to c, then run action if nonnull.
|
long | xor(long b)
Set value to value ^ b. |
public WaitableLong(long initialValue)
Make a new WaitableLong with the given initial value,
and using its own internal lock.
public WaitableLong(long initialValue, Object lock)
Make a new WaitableLong with the given initial value,
and using the supplied lock.
public long add(long amount)
public long and(long b)
Set value to value & b.
Returns: the new value
public boolean commit(long assumedValue, long newValue)
public long complement()
Set the value to its complement
Returns: the new value
public long decrement()
public long divide(long factor)
public long increment()
public long multiply(long factor)
public long or(long b)
Set value to value | b.
Returns: the new value
public long set(long newValue)
public long subtract(long amount)
public void whenEqual(long c, Runnable action)
Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenGreater(long c, Runnable action)
wait until value greater than c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenGreaterEqual(long c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenLess(long c, Runnable action)
wait until value less than c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenLessEqual(long c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenNotEqual(long c, Runnable action)
wait until value not equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public long xor(long b)
Set value to value ^ b.
Returns: the new value