public class FutureBarrier<E>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<IFuture<E>> |
futures
The list of futures.
|
Constructor and Description |
---|
FutureBarrier() |
Modifier and Type | Method and Description |
---|---|
void |
addFuture(IFuture<E> fut)
Add a future to the barrier.
|
int |
getCount()
Get the number of futures.
|
E |
getResult(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.
|
public void addFuture(IFuture<E> fut)
fut
- The future.public IFuture<java.lang.Void> waitFor()
public IFuture<java.lang.Void> waitForIgnoreFailures(ICommand<java.lang.Exception> failurehandler)
public IFuture<java.util.Collection<E>> waitForResults()
public IFuture<java.util.Collection<E>> waitForResultsIgnoreFailures(ICommand<java.lang.Exception> failurehandler)
public E getResult(int index)
index
- The index.public int getCount()