|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.application.Scheduler
public class Scheduler
A scheduler that internally uses a thread pool to permit concurrent execution
of scheduled tasks. This scheduler is preferable to a Timer
when the execution of one task may block long enough to delay execution of
other tasks.
Field Summary | |
---|---|
static long |
NO_INITIAL_DELAY
Specify no initial delay when scheduling a task. |
Constructor Summary | |
---|---|
Scheduler(int poolSize)
Creates a scheduler. |
Method Summary | |
---|---|
void |
purgeTasks()
Tries to remove from the work queue all Future
tasks that have been cancelled. |
java.util.concurrent.ScheduledFuture |
scheduleAtFixedRate(java.lang.Runnable task,
long initialDelay,
long period)
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. |
java.util.concurrent.ScheduledFuture |
scheduleWithFixedDelay(java.lang.Runnable task,
long initialDelay,
long delay)
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. |
void |
shutdown()
Shut down the scheduler in an orderly manner, allowing any currently executing tasks to complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long NO_INITIAL_DELAY
Constructor Detail |
---|
public Scheduler(int poolSize)
poolSize
- The thread pool size.
java.lang.IllegalArgumentException
- if the pool size is less than or equal to zero.Method Detail |
---|
public java.util.concurrent.ScheduledFuture scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long period)
task
- The task to execute.initialDelay
- The initial delay (in msec) before the first execution.period
- The period (in msec) between successive executions.
public java.util.concurrent.ScheduledFuture scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long delay)
task
- The task to execute.initialDelay
- The initial delay (in msec) before the first execution.delay
- The delay (in msec) between termination of one execution
and commencement of the next.
public void purgeTasks()
Future
tasks that have been cancelled. This method can be useful as a
storage reclamation operation, that has no other impact on
functionality. Cancelled tasks are never executed, but may
accumulate in work queues until worker threads can actively
remove them. Invoking this method instead tries to remove them now.
However, this method may fail to remove tasks in
the presence of interference by other threads.
public void shutdown()
shutdown
in interface ShutdownCallback
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |