thinkmap.server.cron
Class CronJob

java.lang.Object
  extended by thinkmap.server.cron.CronJob

public class CronJob
extends Object

A CronJob is a class that encapsulates an Interval and a Runnable job. you add it to the CronTab via the CronTab.addJob() method.


Field Summary
protected  Exception error
           
protected  long lastRun
           
protected  long nextRun
           
 
Constructor Summary
CronJob(Interval i, Runnable run)
          Construct a CronJob to run a particular task at a particular interval.
 
Method Summary
protected  CronJob addJob(CronJob cj)
           
 Interval getInterval()
          Gets the interval that describes how often this job will run.
 Exception getLastError()
          Get the last error that occured when this job was run, null if no error has occured
protected  CronJob getNextJob()
           
 Date getNextRunTime()
          Get the date when this task will run next, or null if it is not currently in the queue
protected  void init()
           
 boolean isRepeatOnError()
          Gets if this job will continue to repeat if an error occurs while running it.
protected  CronJob removeJob(CronJob cj)
           
protected  boolean run()
           
 void setRepeatOnError(boolean b)
          Sets if this job will continue to repeat if an error occurs while running it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

error

protected Exception error

lastRun

protected long lastRun

nextRun

protected long nextRun
Constructor Detail

CronJob

public CronJob(Interval i,
               Runnable run)
Construct a CronJob to run a particular task at a particular interval. Use CronTab.addJob() to actually schedule it.

Method Detail

getInterval

public Interval getInterval()
Gets the interval that describes how often this job will run.


getNextRunTime

public Date getNextRunTime()
Get the date when this task will run next, or null if it is not currently in the queue


getLastError

public Exception getLastError()
Get the last error that occured when this job was run, null if no error has occured


isRepeatOnError

public boolean isRepeatOnError()
Gets if this job will continue to repeat if an error occurs while running it.


setRepeatOnError

public void setRepeatOnError(boolean b)
Sets if this job will continue to repeat if an error occurs while running it.


init

protected void init()

run

protected boolean run()

getNextJob

protected CronJob getNextJob()

removeJob

protected CronJob removeJob(CronJob cj)

addJob

protected CronJob addJob(CronJob cj)


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.