public class WaitableLong extends SynchronizedLong
value_lock_| Constructor and Description |
|---|
WaitableLong(long initialValue)
Make a new WaitableLong with the given initial value,
and using its own internal lock.
|
WaitableLong(long initialValue,
java.lang.Object lock)
Make a new WaitableLong with the given initial value,
and using the supplied lock.
|
| Modifier and Type | Method and Description |
|---|---|
long |
add(long amount)
Add amount to value (i.e., set value += amount)
|
long |
and(long b)
Set value to value & b.
|
boolean |
commit(long assumedValue,
long newValue)
Set value to newValue only if it is currently assumedValue.
|
long |
complement()
Set the value to its complement
|
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 |
or(long b)
Set value to value | b.
|
long |
set(long newValue)
Set to newValue.
|
long |
subtract(long amount)
Subtract amount from value (i.e., set value -= amount)
|
void |
whenEqual(long c,
java.lang.Runnable action)
Wait until value equals c, then run action if nonnull.
|
void |
whenGreater(long c,
java.lang.Runnable action)
wait until value greater than c, then run action if nonnull.
|
void |
whenGreaterEqual(long c,
java.lang.Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
|
void |
whenLess(long c,
java.lang.Runnable action)
wait until value less than c, then run action if nonnull.
|
void |
whenLessEqual(long c,
java.lang.Runnable action)
wait until value less than or equal to c, then run action if nonnull.
|
void |
whenNotEqual(long c,
java.lang.Runnable action)
wait until value not equal to c, then run action if nonnull.
|
long |
xor(long b)
Set value to value ^ b.
|
compareTo, compareTo, compareTo, equals, get, hashCode, negate, swap, toStringexecute, getLockpublic WaitableLong(long initialValue)
public WaitableLong(long initialValue,
java.lang.Object lock)
public long set(long newValue)
SynchronizedLongset in class SynchronizedLongpublic boolean commit(long assumedValue,
long newValue)
SynchronizedLongcommit in class SynchronizedLongpublic long increment()
SynchronizedLongincrement in class SynchronizedLongpublic long decrement()
SynchronizedLongdecrement in class SynchronizedLongpublic long add(long amount)
SynchronizedLongadd in class SynchronizedLongpublic long subtract(long amount)
SynchronizedLongsubtract in class SynchronizedLongpublic long multiply(long factor)
SynchronizedLongmultiply in class SynchronizedLongpublic long divide(long factor)
SynchronizedLongdivide in class SynchronizedLongpublic long complement()
complement in class SynchronizedLongpublic long and(long b)
and in class SynchronizedLongpublic long or(long b)
or in class SynchronizedLongpublic long xor(long b)
xor in class SynchronizedLongpublic void whenEqual(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenNotEqual(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLessEqual(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLess(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreaterEqual(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreater(long c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedException