|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.net4j.util.concurrent.ConcurrentValue<T>
Allow synchronization between many threads for a specific value.
MainThread cv.set(1); Thread1 cv.acquire(3); Thread2 cv.acquire(4); Thread3 cv.acquire(100); Thread4 cv.acquire(new Object() { public boolean equals(Object other) { return other.equals(2) || other.equals(3); } }); Thread5 cv.acquire(1); ... // Thread 1,2,3 and 4 are blocked // Thread 5 isn't blocked. MainThread cv.set(3); // Thread 1 and 4 are unblocked. // Thread 2 and 3 are still blocked.
Constructor Summary | |
---|---|
ConcurrentValue(T value)
|
Method Summary | |
---|---|
void |
acquire(Object accept)
Blocking call. |
T |
get()
|
void |
reevaluate()
Reevaluate the condition. |
void |
set(T newValue)
Specify the new value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConcurrentValue(T value)
Method Detail |
---|
public T get()
public void set(T newValue)
public void reevaluate()
acquire(Object)
and the parameter
passed changed. acquire(Object)
generates a reevaluation automatically.
public void acquire(Object accept) throws InterruptedException
Return when value accept is equal to get()
.
InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |