Package com.arize
Class Response
- java.lang.Object
-
- com.arize.Response
-
public class Response extends Object
Wrapper class holding future response
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResponse.ResponseCode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel()Attempts to cancel execution of this api call.StringgetResponseBody()Waits if necessary for the computation to complete, and then retrieves the response body.Response.ResponseCodegetResponseCode()Waits if necessary for the computation to complete, and then retrieves the response code.booleanisCancelled()Returns true if this task was cancelled before it completed normally.booleanisDone()Returns true if this task completed.voidresolve()Waits if necessary for the computation to complete.voidresolve(long timeout, TimeUnit unit)Waits if necessary for at most the given time for the computation to complete.
-
-
-
Constructor Detail
-
Response
protected Response(Future<org.apache.http.HttpResponse> future)
Wrapper for a Future HttpResponse to abstract away the underlying protocol- Parameters:
future- Future-wrapped HttpResponse
-
-
Method Detail
-
resolve
public void resolve(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutExceptionWaits if necessary for at most the given time for the computation to complete.- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
resolve
public void resolve() throws InterruptedException, ExecutionExceptionWaits if necessary for the computation to complete.
-
getResponseCode
public Response.ResponseCode getResponseCode() throws InterruptedException, ExecutionException
Waits if necessary for the computation to complete, and then retrieves the response code.- Returns:
- ResponseCode The response code for the api call
- Throws:
InterruptedExceptionExecutionException
-
getResponseBody
public String getResponseBody() throws IOException, InterruptedException, ExecutionException
Waits if necessary for the computation to complete, and then retrieves the response body.- Returns:
- The body contents of the response object
- Throws:
IOExceptionInterruptedExceptionExecutionException
-
cancel
public boolean cancel()
Attempts to cancel execution of this api call.- Returns:
- boolean
-
isCancelled
public boolean isCancelled()
Returns true if this task was cancelled before it completed normally.- Returns:
- boolean
-
isDone
public boolean isDone()
Returns true if this task completed.- Returns:
- boolean
-
-