public abstract class AsyncContext<T> extends Object
Context of an asynchronous operation. Combines useful information about the
operation (see getInvocationContext()
) with means to complete the
operation (with a result or an error) or report progress.
This context is the only legal way to complete an operation invocation (with
a result object or an error) or report progress. The invocation will hang
until either setResult(Object)
or
setError(RuntimeException)
marks the operation as complete.
Completing the operation more than once is forbidden. Reporting progress
after the operation is complete is forbidden.
Constructor and Description |
---|
AsyncContext() |
Modifier and Type | Method and Description |
---|---|
abstract InvocationContext |
getInvocationContext()
Returns context information about the method invocation.
|
abstract void |
setError(RuntimeException error)
Completes the invocation with an error.
|
abstract void |
setResult(T result)
Completes the invocation with a result object.
|
abstract void |
updateProgress(Progress progress)
Reports progress for the operation invocation.
|
public abstract InvocationContext getInvocationContext()
public abstract void updateProgress(Progress progress)
setResult(Object)
or
setError(RuntimeException)
is called.progress
- progress status of the operation invocation; must not
be null
public abstract void setResult(T result)
result
- operation resultpublic abstract void setError(RuntimeException error)
error
- operation errorCopyright © 2015. All Rights Reserved.