EDU.oswego.cs.dl.util.concurrent
Class WaitableRef
public
class
WaitableRef
extends SynchronizedRef
Constructor Summary |
| WaitableRef(Object initialValue)
Create a WaitableRef initially holding the given reference
and using its own internal lock.
|
| WaitableRef(Object initialValue, Object lock)
Make a new WaitableRef with the given initial value,
and using the supplied lock.
|
Method Summary |
boolean | commit(Object assumedValue, Object newValue) |
Object | set(Object newValue) |
void | whenEqual(Object c, Runnable action)
Wait until value equals c, then run action if nonnull.
|
void | whenNotEqual(Object c, Runnable action)
wait until value not equal to c, then run action if nonnull.
|
void | whenNotNull(Runnable action)
wait until value is nonnull, then run action if nonnull.
|
void | whenNull(Runnable action)
Wait until value is null, then run action if nonnull.
|
public WaitableRef(Object initialValue)
Create a WaitableRef initially holding the given reference
and using its own internal lock.
public WaitableRef(Object initialValue, Object lock)
Make a new WaitableRef with the given initial value,
and using the supplied lock.
public boolean commit(Object assumedValue, Object newValue)
public Object set(Object newValue)
public void whenEqual(Object c, Runnable action)
Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenNotEqual(Object 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 void whenNotNull(Runnable action)
wait until value is nonnull, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenNull(Runnable action)
Wait until value is null, then run action if nonnull.
The action is run with the synchronization lock held.