Class ConcurrentValue<T>
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.
- Since:
- 2.0
- Author:
- Simon McDuff
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ConcurrentValue
-
-
Method Details
-
get
-
set
Specify the new value. -
reevaluate
public void reevaluate()Reevaluate the condition. It is only useful if a thread is blocked atacquire(Object)
and the parameter passed changed.acquire(Object)
generates a reevaluation automatically. -
acquire
Blocking call.Return when value accept is equal to
get()
.- Throws:
InterruptedException
-