public class Tuple2Future<E,F> extends IntermediateFuture<TupleResult> implements ITuple2Future<E,F>
IForwardCommandFuture.Type
icallers, indices, intermediate, notcommand, results
CALLER_QUEUED, CALLER_RESUMED, CALLER_SUSPENDED, callers, creation, DEBUG, exception, first, listener, listeners, NO_STACK_COMPACTION, NONE, notifications, result, resultavailable, STACK, undone, UNSET
DONE
Constructor and Description |
---|
Tuple2Future()
Create a future that is already done.
|
Tuple2Future(E result1,
F result2)
Create a future that is already done.
|
Tuple2Future(java.lang.Exception exception)
Create a future that is already done (failed).
|
Modifier and Type | Method and Description |
---|---|
void |
addTuple2ResultListener(IFunctionalResultListener<E> firstListener,
IFunctionalResultListener<F> secondListener)
Uses two functional result listeners to create a Tuple2ResultListener and add it.
|
void |
addTuple2ResultListener(IFunctionalResultListener<E> firstListener,
IFunctionalResultListener<F> secondListener,
IFunctionalExceptionListener exceptionListener)
Uses two functional result listeners to create a Tuple2ResultListener and add it.
|
protected TupleResult |
findResult(int idx)
Find result in results
|
E |
getFirstResult()
Get the first result.
|
E |
getFirstResult(long timeout)
Get the first result.
|
E |
getFirstResult(long timeout,
boolean realtime)
Get the first result.
|
E |
getFirstResult(ThreadSuspendable sus)
Deprecated.
- From 3.0. Use method without suspendable.
Will NOT use the suspendable that is supplied as parameter.
Get the first result.
|
protected int |
getMax()
Get the number of results of the type of future..
|
F |
getSecondResult()
Get the second result.
|
F |
getSecondResult(long timeout)
Get the second result.
|
F |
getSecondResult(long timeout,
boolean realtime)
Get the second result.
|
protected java.lang.Object |
getXResult(int idx,
long timeout,
boolean realtime)
Get the x result.
|
protected void |
notifyIntermediateResult(IIntermediateResultListener<TupleResult> listener,
TupleResult result)
Notify a result listener.
|
void |
setFirstResult(E result)
Set the result.
|
void |
setFirstResultIfUndone(E result)
Set the result.
|
void |
setSecondResult(F result)
Set the result.
|
void |
setSecondResultIfUndone(F result)
Set the result.
|
protected void |
setXResult(int idx,
java.lang.Object res)
Set the xth result.
|
protected void |
setXResultIfUndone(int idx,
java.lang.Object res)
Set the xth result.
|
addIntermediateResult, addIntermediateResultIfUndone, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addResultListener, doAddIntermediateResult, doGetNextIntermediateResult, doSetFinished, doSetResult, flatMapAsync, getIntermediateResults, getNextIntermediateResult, getNextIntermediateResult, getNextIntermediateResult, getNotificationCommand, hasNextIntermediateResult, hasNextIntermediateResult, mapAsync, mapAsync, resume, resumeIntermediate, setFinished, setFinishedIfUndone, storeResult
abortGet, acceptEither, addResultListener, addResultListener, applyToEither, delegate, doSetException, exceptionally, exceptionally, exceptionally, executeNotification, get, get, get, get, get, getEmptyFuture, getException, getFuture, hasResultListener, isDone, notifyListener, notifyListener, scheduleNotification, scheduleNotification, scheduleNotification, sendForwardCommand, setException, setExceptionIfUndone, setResult, setResultIfUndone, startScheduledNotifications, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, flatMapAsync, getIntermediateResults, getNextIntermediateResult, getNextIntermediateResult, hasNextIntermediateResult, hasNextIntermediateResult, mapAsync, mapAsync
acceptEither, addResultListener, addResultListener, addResultListener, applyToEither, delegate, exceptionally, exceptionally, exceptionally, get, get, get, get, get, getException, isDone, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
public Tuple2Future()
result
- The result, if any.public Tuple2Future(E result1, F result2)
result
- The result, if any.public Tuple2Future(java.lang.Exception exception)
exception
- The exception.public E getFirstResult(ThreadSuspendable sus)
getFirstResult
in interface ITuple2Future<E,F>
NoSuchElementException,
- when there are no more intermediate results and the future is finished.public E getFirstResult()
getFirstResult
in interface ITuple2Future<E,F>
NoSuchElementException,
- when there are no more intermediate results and the future is finished.public F getSecondResult()
getSecondResult
in interface ITuple2Future<E,F>
NoSuchElementException,
- when there are no more intermediate results and the future is finished.public E getFirstResult(long timeout)
getFirstResult
in interface ITuple2Future<E,F>
timeout
- The timeout in millis.NoSuchElementException,
- when there are no more intermediate results and the future is finished.public F getSecondResult(long timeout)
getSecondResult
in interface ITuple2Future<E,F>
timeout
- The timeout in millis.NoSuchElementException,
- when there are no more intermediate results and the future is finished.public E getFirstResult(long timeout, boolean realtime)
getFirstResult
in interface ITuple2Future<E,F>
timeout
- The timeout in millis.realtime
- Flag if wait should be realtime (in contrast to simulation time).NoSuchElementException,
- when there are no more intermediate results and the future is finished.public F getSecondResult(long timeout, boolean realtime)
getSecondResult
in interface ITuple2Future<E,F>
timeout
- The timeout in millis.realtime
- Flag if wait should be realtime (in contrast to simulation time).NoSuchElementException,
- when there are no more intermediate results and the future is finished.public void setFirstResult(E result)
result
- The result.public void setSecondResult(F result)
result
- The result.public void setFirstResultIfUndone(E result)
result
- The result.public void addTuple2ResultListener(IFunctionalResultListener<E> firstListener, IFunctionalResultListener<F> secondListener)
addTuple2ResultListener
in interface ITuple2Future<E,F>
firstListener
- Listener for the first available result.secondListener
- Listener for the second available result.public void addTuple2ResultListener(IFunctionalResultListener<E> firstListener, IFunctionalResultListener<F> secondListener, IFunctionalExceptionListener exceptionListener)
addTuple2ResultListener
in interface ITuple2Future<E,F>
firstListener
- Listener for the first available result.secondListener
- Listener for the second available result.exListener
- The listener that is called on exceptions. Passing
null
enables default exception logging.public void setSecondResultIfUndone(F result)
result
- The result.protected void setXResult(int idx, java.lang.Object res)
protected void setXResultIfUndone(int idx, java.lang.Object res)
protected java.lang.Object getXResult(int idx, long timeout, boolean realtime)
NoSuchElementException,
- when there are no more intermediate results and the future is finished.protected TupleResult findResult(int idx)
protected int getMax()
protected void notifyIntermediateResult(IIntermediateResultListener<TupleResult> listener, TupleResult result)
notifyIntermediateResult
in class IntermediateFuture<TupleResult>
listener
- The listener.