T
- the return type.X
- the exception type.public abstract class RunnableWithAsyncResultBase<T,X extends java.lang.Throwable> extends java.lang.Object implements java.lang.Runnable
Runnable
that provides a result that can be read asynchronously and
may also throw an exception.Constructor and Description |
---|
RunnableWithAsyncResultBase() |
Modifier and Type | Method and Description |
---|---|
T |
getResult()
Returns the result.
|
boolean |
isFinished()
Returns whether the calculation has been finished.
|
void |
run() |
abstract T |
runWithResult()
Template method for calculating the result.
|
public RunnableWithAsyncResultBase()
public final void run()
run
in interface java.lang.Runnable
public abstract T runWithResult() throws X extends java.lang.Throwable
X extends java.lang.Throwable
public boolean isFinished()
public T getResult() throws X extends java.lang.Throwable
run()
method did not terminate
yet, an AssertionError
is thrown.X extends java.lang.Throwable