| Constructor and Description |
|---|
FutureJobWrapper(Job job) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task.
|
int |
compareTo(Job o) |
void |
done()
Set done to true and interrupts all the threads
|
Request |
get() |
Request |
get(long timeout,
TimeUnit unit) |
Handleable |
getHandler()
Get the handler to handle the response of the job.
|
Priority |
getPriority()
Get the current priority set for this job.
|
Request |
getRequest()
Get the request of this job.
|
int |
getTryCount()
Get attempt number of this job.
|
boolean |
isCancelled()
Returns
true if this task was cancelled before it completed
normally. |
boolean |
isDone()
Returns
true if this task completed. |
void |
reQueue()
Remove any existing in queue, downgrades the priority and
adds the job back into queue.
|
void |
set(Request result)
Sets the result of this future to the given value unless
this future has already been set or has been cancelled.
|
public FutureJobWrapper(Job job)
public Request getRequest()
JobgetRequest in interface Jobpublic Handleable getHandler()
JobIf handler is null, routed handler will be used to assign a handler to the response, based on its criteria.
getHandler in interface Jobpublic Priority getPriority()
JobgetPriority in interface Jobpublic void reQueue()
FutureJob
Does nothing if isDone() == true or isCancelled() == true
or getThreadCount > 0
public int getTryCount()
JobgetTryCount in interface Jobpublic boolean cancel(boolean mayInterruptIfRunning)
Jobcancel 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 Job.isCancelled()
will always return true if this method returned true.
cancel in interface Jobcancel in interface Future<Request>mayInterruptIfRunning - true if the thread executing this
task should be interrupted; otherwise, in-progress tasks are allowed
to completefalse if the task could not be cancelled,
typically because it has already completed normally;
true otherwisepublic boolean isCancelled()
Jobtrue if this task was cancelled before it completed
normally.isCancelled in interface JobisCancelled in interface Future<Request>true if this task was cancelled before it completedpublic boolean isDone()
Jobtrue 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.
public void done()
Jobpublic int compareTo(@Nonnull Job o)
compareTo in interface Comparable<Job>public void set(Request result)
FutureJobCopyright © 2018. All rights reserved.