EDU.oswego.cs.dl.util.concurrent
Class WaitableLong
- Cloneable, Comparable, Executor
public class WaitableLong
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.
|
long | add(long amount) - Add amount to value (i.e., set value += amount)
|
boolean | commit(long assumedValue, long newValue) - Set value to newValue only if it is currently assumedValue.
|
long | decrement() - Decrement the value.
|
long | divide(long factor) - Divide value by factor (i.e., set value /= factor)
|
long | increment() - Increment the value.
|
long | multiply(long factor) - Multiply value by factor (i.e., set value *= factor)
|
long | set(long newValue) - Set to newValue.
|
long | subtract(long amount) - Subtract amount from value (i.e., set value -= 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.
|
add , and , commit , compareTo , compareTo , compareTo , complement , decrement , divide , equals , get , hashCode , increment , multiply , negate , or , set , subtract , swap , toString , xor |
WaitableLong
public WaitableLong(long initialValue)
Make a new WaitableLong with the given initial value,
and using its own internal lock.
WaitableLong
public WaitableLong(long initialValue,
Object lock)
Make a new WaitableLong with the given initial value,
and using the supplied lock.
add
public long add(long amount)
Add amount to value (i.e., set value += amount)
- add in interface SynchronizedLong
commit
public boolean commit(long assumedValue,
long newValue)
Set value to newValue only if it is currently assumedValue.
- commit in interface SynchronizedLong
divide
public long divide(long factor)
Divide value by factor (i.e., set value /= factor)
- divide in interface SynchronizedLong
multiply
public long multiply(long factor)
Multiply value by factor (i.e., set value *= factor)
- multiply in interface SynchronizedLong
subtract
public long subtract(long amount)
Subtract amount from value (i.e., set value -= amount)
- subtract in interface SynchronizedLong
whenEqual
public void whenEqual(long c,
Runnable action)
throws InterruptedException
Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
whenGreater
public void whenGreater(long c,
Runnable action)
throws InterruptedException
wait until value greater than c, then run action if nonnull.
The action is run with the synchronization lock held.
whenGreaterEqual
public void whenGreaterEqual(long c,
Runnable action)
throws InterruptedException
wait until value greater than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
whenLess
public void whenLess(long c,
Runnable action)
throws InterruptedException
wait until value less than c, then run action if nonnull.
The action is run with the synchronization lock held.
whenLessEqual
public void whenLessEqual(long c,
Runnable action)
throws InterruptedException
wait until value less than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
whenNotEqual
public void whenNotEqual(long c,
Runnable action)
throws InterruptedException
wait until value not equal to c, then run action if nonnull.
The action is run with the synchronization lock held.