T
- type of the operation outputpublic abstract class AsyncHandle<T>
extends java.lang.Object
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 for the service implementation (i.e. the server side). However on the client side progress updates might be delivered after the result. For example consider client with an application thread pool - the thread that delivers a progress update might be scheduled before the thread that delivers the result.
Thread-safety: The implementation must be thread-safe. The methods of the callback might be invoked on different threads (for example consider client with an I/O reactor thread pool and/or an application thread pool).
Constructor and Description |
---|
AsyncHandle() |
Modifier and Type | Method and Description |
---|---|
abstract void |
setError(java.lang.RuntimeException error)
Completes the invocation with an error.
|
abstract void |
setResult(T result)
Completes the invocation with an output value.
|
abstract void |
updateProgress(DataValue progress)
Reports progress for the operation invocation.
|
public abstract void updateProgress(DataValue progress)
progress
- progress status of the operation invocationjava.lang.IllegalStateException
- if the operation is already completedpublic abstract void setResult(T result)
result
- operation outputjava.lang.IllegalStateException
- if the operation is already completedpublic abstract void setError(java.lang.RuntimeException error)
error
- operation errorjava.lang.IllegalStateException
- if the operation is already completed