Class ResultFuture<R>
java.lang.Object
ch.nolix.base.programcontrol.future.AbstractFuture
ch.nolix.base.programcontrol.flowcontrol.ResultFuture<R>
- Type Parameters:
R- is the type of the result of aResultFuture.
- All Implemented Interfaces:
IFuture, IResultFuture<R>, FinishRequestable
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T> ResultFuture<T> forResultJobExecutor(ch.nolix.base.programcontrol.flowcontrol.ResultJobExecutor<T> resultJobExecutor) getError()booleanvoidLets the currentIFuturewait until it is finished.voidwaitUntilIsFinished(int timeoutInMilliseconds) Lets the currentIFuturewait until it is finished within the given timeoutInMilliseconds.Waits until the currentIResultFutureis finished and returns its result.Methods inherited from class AbstractFuture
isFinishedSuccessfully, isFinishedWithError, waitUntilIsFinishedSuccessfully, waitUntilIsFinishedSuccessfullyMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FinishRequestable
isRunningMethods inherited from interface IFuture
isFinishedSuccessfully, isFinishedWithError, waitUntilIsFinishedSuccessfully, waitUntilIsFinishedSuccessfully
-
Method Details
-
forResultJobExecutor
public static <T> ResultFuture<T> forResultJobExecutor(ch.nolix.base.programcontrol.flowcontrol.ResultJobExecutor<T> resultJobExecutor) - Type Parameters:
T- is the type of the result of createdResultFuture.- Parameters:
resultJobExecutor-- Returns:
- a new
ResultFuturewith the given resultJobExecutor. - Throws:
RuntimeException- if the given resultJobExecutor is null.
-
caughtError
public boolean caughtError()- Specified by:
caughtErrorin interfaceIFuture- Returns:
- true if the current
IFuturecaught an error, false otherwise.
-
getError
-
getResult
- Specified by:
getResultin interfaceIResultFuture<R>- Returns:
- the result of the current
IResultFuture.
-
isFinished
public boolean isFinished()- Specified by:
isFinishedin interfaceFinishRequestable- Returns:
- true if the current
FinishRequestableis finished, false otherwise.
-
waitUntilIsFinished
public void waitUntilIsFinished()Lets the currentIFuturewait until it is finished.- Specified by:
waitUntilIsFinishedin interfaceIFuture
-
waitUntilIsFinished
public void waitUntilIsFinished(int timeoutInMilliseconds) Lets the currentIFuturewait until it is finished within the given timeoutInMilliseconds.- Specified by:
waitUntilIsFinishedin interfaceIFuture- Parameters:
timeoutInMilliseconds-
-
waitUntilIsFinishedAndGetResult
Waits until the currentIResultFutureis finished and returns its result.- Specified by:
waitUntilIsFinishedAndGetResultin interfaceIResultFuture<R>- Returns:
- the result of the current
IResultFutureafter waiting until it is finished.
-