|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.errai.bus.server.async.TimedTask
public abstract class TimedTask
A TimedTask is used for scheduling tasks, and making sure they are run at appropriate times and intervals
Field Summary | |
---|---|
protected boolean |
cancelled
|
protected Runnable |
exitHandler
|
protected InterruptHandle |
interruptHook
|
protected long |
nextRuntime
|
protected long |
period
|
Constructor Summary | |
---|---|
TimedTask()
|
Method Summary | |
---|---|
boolean |
calculateNextRuntime()
|
void |
cancel()
|
void |
cancel(boolean interrupt)
Prevents this task from being scheduled again, optionally interrupting the task if it is currently running. |
int |
compareTo(TimedTask o)
|
long |
getPeriod()
Gets the period of the task, and when it should be run next |
boolean |
isCancelled()
Returns true if the task has been cancelled or is expired. |
boolean |
isDue(long time)
|
long |
nextRuntime()
Gets the time in which the task will be run. |
void |
setExitHandler(Runnable runnable)
Sets the task that should be run after all executions of this task have completed. |
void |
setPeriod(long period)
Sets the period in which the task should be run next |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
---|
run |
Methods inherited from interface org.jboss.errai.common.client.api.tasks.AsyncTask |
---|
isFinished |
Field Detail |
---|
protected volatile long nextRuntime
protected volatile long period
protected volatile boolean cancelled
protected volatile InterruptHandle interruptHook
protected volatile Runnable exitHandler
Constructor Detail |
---|
public TimedTask()
Method Detail |
---|
public long getPeriod()
public void setPeriod(long period)
period
- public void cancel()
public long nextRuntime()
public void cancel(boolean interrupt)
AsyncTask
cancel
in interface AsyncTask
interrupt
- if true, and this task is presently being executed,
Thread.interrupt()
will be called on the thread currently
executing this task.public boolean isCancelled()
isCancelled
in interface AsyncTask
public boolean calculateNextRuntime()
public boolean isDue(long time)
public void setExitHandler(Runnable runnable)
AsyncTask
setExitHandler
in interface AsyncTask
runnable
- the logic to execute when this task has completed all of its
executions, either because it completed normally, by throwing an
exception, or because it was cancelled by a call to
AsyncTask.cancel(boolean)
.public int compareTo(TimedTask o)
compareTo
in interface Comparable<TimedTask>
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |