R - the type of the result/returnpublic abstract class ReturningRunnable<R>
extends java.lang.Object
| Constructor and Description |
|---|
ReturningRunnable()
Default constructor.
|
ReturningRunnable(java.lang.String operationDescription)
When an exception is thrown, it will be wrapped with another exception with a message
specified by operationDescription.
|
| Modifier and Type | Method and Description |
|---|---|
void |
async(Callback<R> callback)
Runs the code inside
run() on a new Thread asynchronously and returns immediately. |
R |
await()
Runs the code inside
run() synchronously on the same thread this method is called. |
abstract R |
run()
This method contains the underlying operation.
|
public ReturningRunnable()
public ReturningRunnable(java.lang.String operationDescription)
operationDescription - The message of the exception that wraps the underlying exception.public abstract R run() throws java.lang.Exception
java.lang.Exception - Any error from performing the underlying operationpublic R await() throws java.lang.Exception
run() synchronously on the same thread this method is called.run() methodjava.lang.Exception - error from the operation