|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable EDU.oswego.cs.dl.util.concurrent.SynchronizedRef EDU.oswego.cs.dl.util.concurrent.WaitableRef
public class WaitableRef
A class useful for offloading synch for Object reference instance variables.
[ Introduction to this package. ]
Field Summary |
---|
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedRef |
---|
value_ |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
lock_ |
Constructor Summary | |
---|---|
WaitableRef(java.lang.Object initialValue)
Create a WaitableRef initially holding the given reference and using its own internal lock. |
|
WaitableRef(java.lang.Object initialValue,
java.lang.Object lock)
Make a new WaitableRef with the given initial value, and using the supplied lock. |
Method Summary | |
---|---|
boolean |
commit(java.lang.Object assumedValue,
java.lang.Object newValue)
Set value to newValue only if it is currently assumedValue. |
java.lang.Object |
set(java.lang.Object newValue)
Set to newValue. |
void |
whenEqual(java.lang.Object c,
java.lang.Runnable action)
Wait until value equals c, then run action if nonnull. |
void |
whenNotEqual(java.lang.Object c,
java.lang.Runnable action)
wait until value not equal to c, then run action if nonnull. |
void |
whenNotNull(java.lang.Runnable action)
wait until value is nonnull, then run action if nonnull. |
void |
whenNull(java.lang.Runnable action)
Wait until value is null, then run action if nonnull. |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedRef |
---|
get, swap |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
execute, getLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WaitableRef(java.lang.Object initialValue)
public WaitableRef(java.lang.Object initialValue, java.lang.Object lock)
Method Detail |
---|
public java.lang.Object set(java.lang.Object newValue)
SynchronizedRef
set
in class SynchronizedRef
public boolean commit(java.lang.Object assumedValue, java.lang.Object newValue)
SynchronizedRef
commit
in class SynchronizedRef
public void whenNull(java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenNotNull(java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenEqual(java.lang.Object c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenNotEqual(java.lang.Object c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |