An instance of this class is an enqueued request execution obtained by RestBaseManager#getJobOf(int).
More...
An instance of this class is an enqueued request execution obtained by RestBaseManager#getJobOf(int).
◆ RestJob()
◆ cancel() [1/2]
boolean cancel |
( |
boolean |
mayInterruptIfRunning | ) |
|
Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel
is called, this task should never run. If the task has already started, then the mayInterruptIfRunning
parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.
After this method returns, subsequent calls to isDone will always return true
. Subsequent calls to isCancelled will always return true
if this method returned true
.
- Parameters
-
mayInterruptIfRunning | true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete |
- Returns
false
if the task could not be cancelled, typically because it has already completed normally; true
otherwise
◆ cancel() [2/2]
◆ get() [1/2]
Response get |
( |
| ) |
throws InterruptedException, ExecutionException |
Waits if necessary for the computation to complete, and then retrieves its result.
- Returns
- the computed result
- Exceptions
-
java.util.concurrent.ExecutionException | if the computation threw an exception |
InterruptedException | if the current thread was interrupted while waiting |
◆ get() [2/2]
Response get |
( |
long |
timeout, |
|
|
TimeUnit |
unit |
|
) |
| throws InterruptedException, ExecutionException, TimeoutException |
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
- Parameters
-
timeout | the maximum time to wait |
unit | the time unit of the timeout argument |
- Returns
- the computed result
- Exceptions
-
java.util.concurrent.ExecutionException | if the computation threw an exception |
InterruptedException | if the current thread was interrupted while waiting |
java.util.concurrent.TimeoutException | if the wait timed out |
◆ getCallback()
Retrieve the callback to invoke upon the competition of this job.
- Returns
- the callback or null if there is no callback associated to this job
◆ getRequest()
Retrieve the request of this job.
- Returns
- the produced HTTP request of this job
◆ getResponse()
Obtain the response of this job.
- Returns
- the resulting HTTP response
◆ getTimeout()
Retrieve the connection timeout applied when sending the HTTP request of this job.
- Returns
- the connection timeout in seconds
◆ isCancelled()
Returns true
if this task was cancelled before it completed normally.
- Returns
true
if this task was cancelled before it completed
◆ isDone()
Returns true
if this task completed.
Completion may be due to normal termination, an exception, or cancellation – in all of these cases, this method will return true
.
- Returns
true
if this task completed
◆ run()
Runnable implementation executed in the spooler thread. Do not directly invoke this method.