All Packages  This Package  Class Hierarchy  Class Search  Index

Class kh.util.PeriodicTask
java.lang.Object
   |
   +----kh.util.PeriodicTask

  Summary

public abstract class  PeriodicTask
     extends java.lang.Object
     implements java.lang.Runnable
{
          // Fields 2
     protected long initialDelta;
     protected long period;

          // Constructors 1
     public PeriodicTask(long, long);

          // Methods 5
     public Thread getThread();
     public String getThreadName();
     protected abstract void periodicTask();
     public void run();
     public void start();
}

This class provides an easy way to invoke a method on a set schedule. Every period the method periodTask() will be invoked. Each perios is a set number of ms apart, with the first period being delayed by a seperate initialDelta in ms. This initial delta is designed to stagger the start of a number of objects which are created at the same time.




  Fields

· initialDelta

Summary  |  Top

   protected long initialDelta


· period

Summary  |  Top
   protected long period


  Constructors

· PeriodicTask

Summary  |  Top

   public PeriodicTask(long period, 
                       long initialDelta) 

Creates a PeriodicTask, see the class documentation for more info. NOTE: the task is not started until start() is invoked.



  Methods

· getThread

Summary  |  Top
   public Thread getThread() 

Returns the thread which is responsible for this periodic task



· getThreadName

Summary  |  Top
   public String getThreadName() 

Returns the name we should give our thread



· periodicTask

Summary  |  Top
   protected abstract void periodicTask() 

This method is invoked once per period.



· run

Summary  |  Top
   public void run() 

Our thread. We block for 24 hrs at a time, then do a backup.

Implements:
run in interface Runnable


· start

Summary  |  Top
   public void start() 

Starts running our task - NOTE: We allow start to work on a already running task.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7