Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jreceiver.util
Class ScheduledDaemon  view ScheduledDaemon download ScheduledDaemon.java

java.lang.Object
  extended byjreceiver.util.Daemon
      extended byjreceiver.util.ScheduledDaemon

public abstract class ScheduledDaemon
extends Daemon

Generic daemon to which clients can subscribe to status messages and whose worker thread can be scheduled to run periodically.

Version:
$Revision: 1.1 $ $Date: 2002/07/20 03:18:07 $

Field Summary
protected static org.apache.commons.logging.Log log
          logging object
protected  java.util.Date next_execution_time
           
protected  long schedule_period
           
protected  java.util.Timer timer
          for scheduling worker thread
 
Fields inherited from class jreceiver.util.Daemon
thread_name, worker_thread
 
Constructor Summary
ScheduledDaemon(java.lang.String thread_name)
          ctor
 
Method Summary
 java.util.Date getSchedule()
          obtain the time the daemon will next run; null if disabled
 void scheduleAtFixedRate(java.util.Date first_time, long period)
          Schedules the daemon's worker thread for repeated fixed-rate execution, beginning at the specified time.
 void scheduleCancel()
          cancel any existing schedule for the worker thread
 
Methods inherited from class jreceiver.util.Daemon
doWork, makeThread, sleep, start, stop, stopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next_execution_time

protected java.util.Date next_execution_time

schedule_period

protected long schedule_period

timer

protected java.util.Timer timer
for scheduling worker thread


log

protected static org.apache.commons.logging.Log log
logging object

Constructor Detail

ScheduledDaemon

public ScheduledDaemon(java.lang.String thread_name)
ctor

Method Detail

scheduleAtFixedRate

public void scheduleAtFixedRate(java.util.Date first_time,
                                long period)
Schedules the daemon's worker thread for repeated fixed-rate execution, beginning at the specified time. Subsequent executions take place at approximately regular intervals, separated by the specified period.

Calling this method will cancel any existing schedule for the daemon.

Using this means of scheduling work is preferable when time spans between runs are long where you don't want to keep resources (like sockets) open.


scheduleCancel

public void scheduleCancel()
cancel any existing schedule for the worker thread


getSchedule

public java.util.Date getSchedule()
obtain the time the daemon will next run; null if disabled