|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AsyncResult<T>
Asynchronous result is a multi-thread object that operates as a container
for a result. The result is either an error or the result object.
The result can be
blocked (waitForResult()),
polled (getResult() and getError()), or
listened to setListener(ResultListener).
AsyncResult can be used from any thread and from multiple-thread.
AsyncResultImpl| Nested Class Summary | |
|---|---|
static class |
AsyncResult.AsyncResultStatus
|
| Method Summary | |
|---|---|
ServiceResultException |
getError()
getError. |
T |
getResult()
Get result if available |
AsyncResult.AsyncResultStatus |
getStatus()
Get request status |
void |
setListener(ResultListener<T> listener)
Set a listener. |
T |
waitForResult()
Wait for result until result is available. |
T |
waitForResult(long timeout,
TimeUnit unit)
Wait for result or time out. |
| Method Detail |
|---|
void setListener(ResultListener<T> listener)
listener - (listener may not block) or null to remove listener
T getResult()
throws ServiceResultException
ServiceResultException - if errorServiceResultException getError()
getError.
ServiceResultException object.AsyncResult.AsyncResultStatus getStatus()
T waitForResult()
throws ServiceResultException
ServiceResultException - network error, e.g. IOException of MethodNotSupportedException
T waitForResult(long timeout,
TimeUnit unit)
throws ServiceResultException
timeout - time out valueunit - time unit
ServiceResultException - error during invocation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||