|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

public interface IFutureResponse
The IFutureResponse represents the result of an asynchronous call. Methods are provided to check if
the call is complete, to wait for its completion, and to retrieve the result of the computation.
The result can only be retrieved using method get when the computation has completed, blocking if
necessary until it is ready. Cancellation is performed by the cancel method.
Additional methods are provided to determine if the task completed normally or was cancelled.
Once a computation has completed, the computation cannot be cancelled.
Example:
HttpClient client = new HttpClient(); IFutureResponse futureResponse = client.send(url); // do something else IHttpResponse response = futureResponse.getResponse(); // ...
| Method Summary | |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of receiving the response. |
IHttpResponse |
get()
blocking call to retrieve the response. |
IHttpResponse |
get(long timeout,
TimeUnit unit)
blocking call to retrieve the response. |
IHttpResponse |
getResponse()
blocking call to retrieve the response. |
IHttpResponse |
getResponse(long timeout,
TimeUnit unit)
blocking call to retrieve the response. |
boolean |
isCancelled()
Returns true if this task was cancelled before it completed normally. |
boolean |
isDone()
Returns true if this task completed. |
| Method Detail |
|---|
IHttpResponse getResponse()
throws IOException,
InterruptedException,
SocketTimeoutException
Future.get()
IOException - if an ioe exception occurs
InterruptedException - if the current thread was interrupted while waiting
SocketTimeoutException - if an socket timeout exception occurs
IHttpResponse getResponse(long timeout,
TimeUnit unit)
throws IOException,
InterruptedException,
SocketTimeoutException
Future.get(long, TimeUnit)
timeout - the maximum time to waitunit - the time unit of the timeout argument
IOException - if an ioe exception occurs
InterruptedException - if the current thread was interrupted while waiting
SocketTimeoutException - if an socket timeout exception occurs
IHttpResponse get()
throws InterruptedException,
ExecutionException
getResponse() method will be used instead of this method.
get in interface Future<IHttpResponse>InterruptedException
ExecutionException
IHttpResponse get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
getResponse(long, TimeUnit) method will be used instead of this method.
get in interface Future<IHttpResponse>InterruptedException
ExecutionException
TimeoutExceptionboolean isDone()
isDone in interface Future<IHttpResponse>boolean cancel(boolean mayInterruptIfRunning)
cancel in interface Future<IHttpResponse>mayInterruptIfRunning - true if the receiving process should be interrupted
boolean isCancelled()
isCancelled in interface Future<IHttpResponse>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||