Package jadex.commons.future
Class FutureBarrier<E>
- java.lang.Object
- 
- jadex.commons.future.FutureBarrier<E>
 
- 
 public class FutureBarrier<E> extends java.lang.ObjectA future barrier allows for waiting for a variable number of futures. Calling waitFor will wait until all futures are done.
- 
- 
Constructor SummaryConstructors Constructor Description FutureBarrier()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFuture(IFuture<E> fut)Add a future to the barrier.intgetCount()Get the number of futures.EgetResult(int index)Get the nth result.IFuture<java.lang.Void>waitFor()Wait for all added futures being finished.IFuture<java.lang.Void>waitForIgnoreFailures(ICommand<java.lang.Exception> failurehandler)Wait for all added futures being finished.IFuture<java.util.Collection<E>>waitForResults()Wait for all added futures being finished and collect the results.IFuture<java.util.Collection<E>>waitForResultsIgnoreFailures(ICommand<java.lang.Exception> failurehandler)Wait for all added futures being finished and collect the results.
 
- 
- 
- 
Method Detail- 
addFuturepublic void addFuture(IFuture<E> fut) Add a future to the barrier.- Parameters:
- fut- The future.
 
 - 
waitForpublic IFuture<java.lang.Void> waitFor() Wait for all added futures being finished.
 - 
waitForIgnoreFailurespublic IFuture<java.lang.Void> waitForIgnoreFailures(ICommand<java.lang.Exception> failurehandler) Wait for all added futures being finished. Ignore failures and call optional failure handler, if any.
 - 
waitForResultspublic IFuture<java.util.Collection<E>> waitForResults() Wait for all added futures being finished and collect the results.
 - 
waitForResultsIgnoreFailurespublic IFuture<java.util.Collection<E>> waitForResultsIgnoreFailures(ICommand<java.lang.Exception> failurehandler) Wait for all added futures being finished and collect the results. Ignore failures and call optional failure handler, if any.
 - 
getResultpublic E getResult(int index) Get the nth result. Must be called after the barrier is due.- Parameters:
- index- The index.
 
 - 
getCountpublic int getCount() Get the number of futures. May be called before the barrier is done.
 
- 
 
-