public final class RequestProcessor.Task extends Task implements Cancellable
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Removes the task from the queue.
|
int |
getDelay()
Getter for amount of millis till this task
is started.
|
int |
getPriority()
Current priority of the task.
|
void |
run()
Start the task.
|
void |
schedule(int delay)
(Re-)schedules a task to run in the future.
|
void |
setPriority(int priority)
Changes the priority the task will be performed with.
|
String |
toString() |
void |
waitFinished()
This method is an implementation of the waitFinished method
in the RequestProcessor.Task.
|
boolean |
waitFinished(long timeout)
Enhanced reimplementation of the
Task.waitFinished(long)
method. |
addTaskListener, isFinished, notifyFinished, notifyRunning, removeTaskListener
public void run()
Task
Task.notifyFinished()
.
Subclasses may override this method, but they
then need to call Task.notifyFinished()
explicitly.
Note that this call runs synchronously, but typically the creator of the task will call this method in a separate thread.
public int getDelay()
public void schedule(int delay)
delay
- time in milliseconds to wait (starting from now)public boolean cancel()
cancel
in interface Cancellable
public int getPriority()
Thread.NORM_PRIORITY
public void setPriority(int priority)
priority
- the priority level (see e.g. Thread.NORM_PRIORITY
public void waitFinished()
waitFinished
in class Task
public boolean waitFinished(long timeout) throws InterruptedException
Task.waitFinished(long)
method. The added semantic is that if one calls this method from
another task of the same processor, and the task has not yet been
executed, the method will immediatelly detect that and throw
InterruptedException
to signal that state.waitFinished
in class Task
timeout
- the amount of time to waitInterruptedException
- if waiting has been interrupted or if
the wait cannot succeed due to possible deadlock collision