public class ScheduledRunner extends GSThread
 ScheduledRunner is a single daemon thread that wakes up at fixed intervals, to run a single
 Runnable task. Calling cancel() method will wake up and terminate this daemon
 thread. 
 Much like Timer but without the overhead of a managed queue of
 tasks. 
 Usage:
 ScheduledRunner runner =
        new ScheduledRunner( new YourRunnable(), "Runnable Name", 0 /delay/, 1000 /period/);
 ...
 runner.reschedule(2000); //reschedule with a new period
 ...
 runner.cancel();       //cancel - no longer needed
 runner = null;         //help gc
 Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description | 
|---|
| ScheduledRunner(Runnable target,
               long delay,
               long period)Allocates a new  ScheduledRunnerobject. | 
| ScheduledRunner(Runnable target,
               String name,
               long delay,
               long period)Allocates a new  ScheduledRunnerobject. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | cancel()Cancels all subsequent executions of the Runnable target. | 
| void | reschedule(long period)Reschedules this Runnable execution for a new specified duration immediately. | 
| void | run()Runs the Runnable target's  runmethod after every sleep interval unlesscancelmethod was invoked, or if this thread was Interrupted. | 
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic ScheduledRunner(Runnable target, long delay, long period)
ScheduledRunner object. This constructor has the same effect as
 ScheduledRunner(target,  name) where name is the
 target's class name.target - the object whose run method is called.delay - delay in milliseconds before task is to be executed.period - time in milliseconds between successive Runnable target executions.Thread(java.lang.Runnable, java.lang.String)public ScheduledRunner(Runnable target, String name, long delay, long period)
ScheduledRunner object. This constructor has the same effect as
 ScheduledRunner(target) where name is a chosen name for this Runnable
 target.target - the object whose run method is called.name - the chosen name for this Runnable target.period - time in milliseconds between successive Runnable target executions.Thread(java.lang.Runnable, java.lang.String)public void run()
run method after every sleep interval unless
 cancel method was invoked, or if this thread was Interrupted.public final void reschedule(long period)
period - the new period for this Runnable target.public void cancel()
Copyright © GigaSpaces.