public class IntermediateFuture<E> extends Future<Collection<E>> implements IIntermediateFuture<E>
DEBUG, EMPTY, NO_STACK_COMPACTION, STACKDONE| Constructor and Description |
|---|
IntermediateFuture()
Create a future that is already done.
|
IntermediateFuture(Collection<E> results)
Create a future that is already done.
|
IntermediateFuture(Exception exception)
Create a future that is already done (failed).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addIntermediateResult(E result)
Add an intermediate result.
|
boolean |
addIntermediateResultIfUndone(E result)
Set the result.
|
void |
addResultListener(IResultListener<Collection<E>> listener)
Add a result listener.
|
Collection<E> |
getIntermediateResults()
Get the intermediate results that are available.
|
E |
getNextIntermediateResult(ISuspendable caller)
Iterate over the intermediate results in a blocking fashion.
|
boolean |
hasNextIntermediateResult(ISuspendable caller)
Check if there are more results for iteration for the given caller.
|
void |
setFinished()
Declare that the future is finished.
|
boolean |
setFinishedIfUndone()
Declare that the future is finished.
|
void |
setResult(Collection<E> result)
Set the result.
|
boolean |
setResultIfUndone(Collection<E> result)
Set the result.
|
get, get, getEmptyFuture, getException, isDone, setException, setExceptionIfUndoneequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, get, getException, isDonepublic IntermediateFuture()
result - The result, if any.public IntermediateFuture(Collection<E> results)
result - The result, if any.public IntermediateFuture(Exception exception)
exception - The exception.public Collection<E> getIntermediateResults()
getIntermediateResults in interface IIntermediateFuture<E>public void addIntermediateResult(E result)
public boolean addIntermediateResultIfUndone(E result)
result - The result.public void setResult(Collection<E> result)
setResult in class Future<Collection<E>>result - The result.public boolean setResultIfUndone(Collection<E> result)
setResultIfUndone in class Future<Collection<E>>result - The result.public void setFinished()
public boolean setFinishedIfUndone()
public void addResultListener(IResultListener<Collection<E>> listener)
addResultListener in interface IFuture<Collection<E>>addResultListener in class Future<Collection<E>>listsner - The listener.public boolean hasNextIntermediateResult(ISuspendable caller)
hasNextIntermediateResult in interface IIntermediateFuture<E>caller - The caller that wants to iterate over intermediate results.public E getNextIntermediateResult(ISuspendable caller)
getNextIntermediateResult in interface IIntermediateFuture<E>caller - The caller that wants to iterate over intermediate results.NoSuchElementException, - when there are no more intermediate results and the future is finished.Copyright © 2012. All Rights Reserved.