Package jadex.future
Class FutureBarrier<E>
java.lang.Object
jadex.future.FutureBarrier<E>
A future barrier allows for waiting for a variable number
of futures. Calling waitFor will wait until all futures are done.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a future to the barrier.int
getCount()
Get the number of futures.getResult
(int index) Get the nth result.waitFor()
Wait for all added futures being finished.waitForIgnoreFailures
(jadex.common.ICommand<Exception> failurehandler) Wait for all added futures being finished.Wait for all added futures being finished and collect the results.waitForResultsIgnoreFailures
(jadex.common.ICommand<Exception> failurehandler) Wait for all added futures being finished and collect the results.
-
Field Details
-
futures
The list of futures.
-
-
Constructor Details
-
FutureBarrier
public FutureBarrier()
-
-
Method Details
-
addFuture
Add a future to the barrier.- Parameters:
fut
- The future.
-
waitFor
Wait for all added futures being finished. -
waitForIgnoreFailures
Wait for all added futures being finished. Ignore failures and call optional failure handler, if any. -
waitForResults
Wait for all added futures being finished and collect the results. -
waitForResultsIgnoreFailures
public IFuture<Collection<E>> waitForResultsIgnoreFailures(jadex.common.ICommand<Exception> failurehandler) Wait for all added futures being finished and collect the results. Ignore failures and call optional failure handler, if any. -
getResult
Get the nth result. Must be called after the barrier is due.- Parameters:
index
- The index.
-
getCount
public int getCount()Get the number of futures. May be called before the barrier is done.
-