Package org.nustaq.kontraktor.util
Class PromiseLatch<T>
java.lang.Object
org.nustaq.kontraktor.util.PromiseLatch<T>
Created by ruedi on 27.07.14.
Wraps a future and triggers it after having received N results (counter is counted down).
Note that only the last result/error is actually transmitteed to the wrapped future.
An implementation collecting intermediate results in a concurrentlist which then is
used as a result could be implemented if needed.
Usually used for pure signaling (so result is "void")
-
Constructor Summary
ConstructorsConstructorDescriptionPromiseLatch
(int counter) PromiseLatch
(int counter, IPromise<T> wrapped) PromiseLatch
(IPromise<T> wrapped) PromiseLatch
(IPromise<T> wrapped, int counter) -
Method Summary
-
Constructor Details
-
PromiseLatch
-
PromiseLatch
-
PromiseLatch
public PromiseLatch(int counter) -
PromiseLatch
-
-
Method Details
-
countDown
public void countDown() -
countDown
-
isComplete
public boolean isComplete() -
countUp
public void countUp(int amount) -
getCount
public int getCount()debug, cannot be used to implement reliable logic in a concurrent environment- Returns:
-
getPromise
-
reject
-