R
- result typepublic class AsyncCall<R> extends Object
Constructor and Description |
---|
AsyncCall(String id,
ExecutableTask<R> task,
Future<R> future) |
Modifier and Type | Method and Description |
---|---|
void |
awaitCompletion(Long timeoutMs)
Waits if necessary for at most the given time for the call to complete.
|
R |
awaitCompletionAndGetResult()
Waits if necessary for at most the given time for the call to complete and returns it's result.
|
R |
awaitCompletionAndGetResult(Long completionTimeoutMs)
Waits if necessary for at most the given time for the call to complete, and then retrieves its result, if available.
|
String |
getId() |
R |
getResultOrNull()
Gets the result if the call has been completed or
null if not. |
ExecutableTask<R> |
getTask() |
public AsyncCall(String id, ExecutableTask<R> task, Future<R> future)
public String getId()
public ExecutableTask<R> getTask()
public R getResultOrNull()
null
if not.null
if not completed yet.RuntimeException
- if the computation threw an unchecked exception (direct type will be thrown)UncheckedExecutionException
- if the computation threw a checked exception (wrapped)public void awaitCompletion(Long timeoutMs)
timeoutMs
- the maximum time in millis to wait public R awaitCompletionAndGetResult()
RuntimeException
- if the computation threw an unchecked exception (direct type will be thrown)UncheckedExecutionException
- if the computation threw a checked exception (wrapped)public R awaitCompletionAndGetResult(Long completionTimeoutMs)
completionTimeoutMs
- the maximum time in millis to wait RuntimeException
- if the computation threw an unchecked exception (direct type will be thrown)UncheckedExecutionException
- if the computation threw a checked exception (wrapped)