|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simpleframework.util.thread.Scheduler
public class Scheduler
The Scheduler
object is used to schedule tasks for
execution. This queues the task for the requested period of time
before it is executed. It ensures that the delay is adhered to
such that tasks can be timed for execution in an accurate way.
Constructor Summary | |
---|---|
Scheduler(int size)
Constructor for the Scheduler object. |
Method Summary | |
---|---|
void |
execute(java.lang.Runnable task)
This will execute the task within the executor immediately as it uses a delay duration of zero milliseconds. |
void |
execute(java.lang.Runnable task,
long delay)
This will execute the task within the executor after the time specified has expired. |
void |
execute(java.lang.Runnable task,
long delay,
java.util.concurrent.TimeUnit unit)
This will execute the task within the executor after the time specified has expired. |
void |
stop()
This is used to stop the executor by interrupting all running tasks and shutting down the threads within the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Scheduler(int size)
Scheduler
object. This will
create a scheduler with a fixed number of threads to use
before execution. Depending on the types of task that are
to be executed this should be increased for accuracy.
size
- this is the number of threads for the schedulerMethod Detail |
---|
public void execute(java.lang.Runnable task)
execute
in interface java.util.concurrent.Executor
task
- this is the task to schedule for executionpublic void execute(java.lang.Runnable task, long delay)
task
- this is the task to schedule for executiondelay
- the time in milliseconds to wait for executionpublic void execute(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
task
- this is the task to schedule for executiondelay
- this is the delay to wait before executionunit
- this is the duration time unit to wait forpublic void stop()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |