|
||||||||
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
public class SynchronizedRef
A simple class maintaining a single reference variable that is always accessed and updated under synchronization.
[ Introduction to this package. ]
Field Summary | |
---|---|
protected java.lang.Object |
value_
The maintained reference |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
lock_ |
Constructor Summary | |
---|---|
SynchronizedRef(java.lang.Object initialValue)
Create a SynchronizedRef initially holding the given reference and using its own internal lock. |
|
SynchronizedRef(java.lang.Object initialValue,
java.lang.Object lock)
Make a new SynchronizedRef 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 |
get()
Return the current value |
java.lang.Object |
set(java.lang.Object newValue)
Set to newValue. |
java.lang.Object |
swap(SynchronizedRef other)
Atomically swap values with another SynchronizedRef. |
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 |
Field Detail |
---|
protected java.lang.Object value_
Constructor Detail |
---|
public SynchronizedRef(java.lang.Object initialValue)
public SynchronizedRef(java.lang.Object initialValue, java.lang.Object lock)
Method Detail |
---|
public final java.lang.Object get()
public java.lang.Object set(java.lang.Object newValue)
public boolean commit(java.lang.Object assumedValue, java.lang.Object newValue)
public java.lang.Object swap(SynchronizedRef other)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |