Class PromiseLatch<T>

java.lang.Object
org.nustaq.kontraktor.util.PromiseLatch<T>

public class PromiseLatch<T>
extends java.lang.Object
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

    Constructors 
    Constructor Description
    PromiseLatch​(int counter)  
    PromiseLatch​(int counter, IPromise<T> wrapped)  
    PromiseLatch​(IPromise<T> wrapped)  
    PromiseLatch​(IPromise<T> wrapped, int counter)  
  • Method Summary

    Modifier and Type Method Description
    void countDown()  
    void countDown​(T result, java.lang.Object error)  
    void countUp​(int amount)  
    int getCount()
    debug, cannot be used to implement reliable logic in a concurrent environment
    IPromise<T> getPromise()  
    boolean isComplete()  
    void reject​(java.lang.String err)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait