public class AsyncResultImpl<T> extends Object implements AsyncResult<T>
AsyncResultImpl class.
AsyncResult.AsyncResultStatus| Constructor and Description |
|---|
AsyncResultImpl()
Constructor for AsyncResultImpl.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> AsyncResultImpl<T> |
failed(ServiceResultException failure)
Returns new
AsyncResultImpl that has already failed with the given error. |
ServiceResultException |
getError()
getError.
|
T |
getResult()
Get result if available
|
AsyncResult.AsyncResultStatus |
getStatus()
Get request status
|
void |
setError(ServiceResultException error)
Set error, invokes any listener in executor thread.
|
void |
setErrorSync(ServiceResultException error)
Set error, invokes any listener here and now.
|
void |
setListener(ResultListener<T> listener)
Set a listener.
|
void |
setResult(T result)
Set error, invokes any listener in excutor thread
If result or error has already been set, this method does nothing.
|
void |
setResultSync(T result)
setResultSync.
|
void |
setSource(AsyncResult<T> source)
Links another result as a source of this result object
|
T |
waitForResult()
Wait for result until result is available.
|
T |
waitForResult(long timeout,
TimeUnit unit)
Wait for result or time out.
|
public static <T> AsyncResultImpl<T> failed(ServiceResultException failure)
AsyncResultImpl that has already failed with the given error.public ServiceResultException getError()
getError.
getError in interface AsyncResult<T>ServiceResultException object.public T getResult()
getResult in interface AsyncResult<T>public AsyncResult.AsyncResultStatus getStatus()
getStatus in interface AsyncResult<T>public void setError(ServiceResultException error)
error - a ServiceResultException object.public void setErrorSync(ServiceResultException error) throws RuntimeException
RuntimeExceptionerror - a ServiceResultException object.RuntimeException - if any.public void setListener(ResultListener<T> listener)
setListener in interface AsyncResult<T>listener - (listener may not block) or null to remove listenerpublic void setResult(T result)
result - a T object.public void setResultSync(T result) throws RuntimeException
setResultSync.
result - a T object.RuntimeException - if any.public void setSource(AsyncResult<T> source)
source - a AsyncResult object.public T waitForResult() throws ServiceResultException
waitForResult in interface AsyncResult<T>ServiceResultException - network error, e.g. IOException of
MethodNotSupportedExceptionpublic T waitForResult(long timeout, TimeUnit unit) throws ServiceResultException
waitForResult in interface AsyncResult<T>timeout - time out valueunit - time unitServiceResultException - error during invocationCopyright © 2026. All rights reserved.