org.mmbase.applications.crontab
Class CronEntry

java.lang.Object
  extended by org.mmbase.applications.crontab.CronEntry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
NodeCronEntry

public class CronEntry
extends Object
implements Serializable

Defines one entry for CronDaemon. This class is used by the CronDaemon.

Version:
$Id: CronEntry.java 42087 2010-05-03 12:46:24Z michiel $
Author:
Kees Jongenburger, Michiel Meeuwissen
See Also:
Serialized Form

Nested Class Summary
static class CronEntry.Type
           
 
Field Summary
static Pattern ALL
           
protected  int count
           
protected  String cronTime
           
protected  int lastCost
           
protected  Date lastRun
           
protected  long maxDuration
           
 
Constructor Summary
CronEntry(String id, String cronTime, String name, String className, String configuration)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, CronEntry.Type type)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, CronEntry.Type type, Pattern servers)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, String typeString)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, String typeString, Pattern servers)
           
 
Method Summary
 boolean equals(Object o)
          Two CronEntrys as considered equal if they have the same id, name, classname and configuration.
 String getClassName()
           
 String getConfiguration()
           
 int getCount()
           
 String getCronTime()
           
 CronEntryField getDayOfMonthEntry()
           
 CronEntryField getDayOfWeekEntry()
           
(package private)  Interruptable getExecutable()
           
 CronEntryField getHourEntry()
           
 String getId()
           
 int getLastCost()
           
 Date getLastRun()
           
 long getMaxDuration()
           
 CronEntryField getMinuteEntry()
           
 CronEntryField getMonthEntry()
           
 String getName()
           
 String getServers()
          A String indicating on the servers on wich this Job must run.
 Interruptable getThread(int i)
           
 List<Interruptable> getThreads()
           
 CronEntry.Type getType()
           
 int hashCode()
           
protected  void incCount()
           
 void init()
           
 boolean interrupt(int thread)
           
 boolean isActive()
          Whether this Entry would run.
 boolean isAlive()
           
 boolean isAlive(int i)
          Wether a job associated with this cron entry is currently alive on this machine.
 boolean isMustBeOne()
           
 boolean kick(Date currentTime)
           
(package private)  boolean mustRun(Date date)
           
 void setConfiguration(String conf)
           
protected  void setCronTime(String cronTime)
           
protected  void setLastCost(int s)
           
protected  void setLastRun(Date d)
           
 void stop()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final Pattern ALL

cronTime

protected final String cronTime

lastRun

protected Date lastRun

count

protected int count

lastCost

protected int lastCost

maxDuration

protected long maxDuration
Constructor Detail

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration)
          throws Exception
Throws:
Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 String typeString)
          throws Exception
Throws:
Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 String typeString,
                 Pattern servers)
          throws Exception
Throws:
Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 CronEntry.Type type)
          throws Exception
Throws:
ClassCastException - if className does not refer to a Runnable.
RuntimeException - if the cronTime format isn't correct
Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 CronEntry.Type type,
                 Pattern servers)
          throws Exception
Throws:
ClassCastException - if className does not refer to a Runnable.
RuntimeException - if the cronTime format isn't correct
Exception
Method Detail

init

public void init()

stop

public void stop()

getThread

public Interruptable getThread(int i)
Since:
MMBase-1.8

getThreads

public List<Interruptable> getThreads()

interrupt

public boolean interrupt(int thread)

isAlive

public boolean isAlive(int i)
Wether a job associated with this cron entry is currently alive on this machine.

Since:
MMBase-1.8

isAlive

public boolean isAlive()

isActive

public boolean isActive()
Whether this Entry would run. It would not run if it is only scheduled to run on other machines.

Since:
MMBase-1.8.7

isMustBeOne

public boolean isMustBeOne()

getServers

public String getServers()
A String indicating on the servers on wich this Job must run. This may be regular expression and used in the implementation of isActive(), but this is not required.


getExecutable

Interruptable getExecutable()

kick

public boolean kick(Date currentTime)

setCronTime

protected void setCronTime(String cronTime)

getCronTime

public String getCronTime()

getId

public String getId()

getName

public String getName()

setConfiguration

public void setConfiguration(String conf)

getConfiguration

public String getConfiguration()

getType

public CronEntry.Type getType()

getClassName

public String getClassName()

getLastRun

public Date getLastRun()

setLastRun

protected void setLastRun(Date d)

getCount

public int getCount()

incCount

protected void incCount()

getLastCost

public int getLastCost()

setLastCost

protected void setLastCost(int s)

getMaxDuration

public long getMaxDuration()

mustRun

boolean mustRun(Date date)

getMinuteEntry

public CronEntryField getMinuteEntry()

getHourEntry

public CronEntryField getHourEntry()

getDayOfMonthEntry

public CronEntryField getDayOfMonthEntry()

getMonthEntry

public CronEntryField getMonthEntry()

getDayOfWeekEntry

public CronEntryField getDayOfWeekEntry()

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Two CronEntrys as considered equal if they have the same id, name, classname and configuration.

Overrides:
equals in class Object


MMBase 2.0-SNAPSHOT - null