| org.apache.turbine.services.schedule.JobEntry
JobEntry | public class JobEntry extends BaseJobEntry implements Comparable(Code) | | This is a wrapper for a scheduled job. It is modeled after the
Unix scheduler cron. Note: BaseJobEntry is generated by Torque
at compile time, and is therefore NOT in CVS.
author: Dave Bryson author: Quinton McCombs version: $Id: JobEntry.java 534527 2007-05-02 16:10:59Z tv $ |
Constructor Summary | |
public | JobEntry() | public | JobEntry(int sec, int min, int hour, int wd, int day_mo, String task) Constuctor.
Schedule a job to run on a certain point of time.
Example 1: Run the DefaultScheduledJob at 8:00am every 15th of
the month -
JobEntry je = new JobEntry(0,0,8,15,"DefaultScheduledJob");
Example 2: Run the DefaultScheduledJob at 8:00am every day -
JobEntry je = new JobEntry(0,0,8,-1,"DefaultScheduledJob");
Example 3: Run the DefaultScheduledJob every 2 hours. |
Method Summary | |
public void | calcRunTime() Calculate how long before the next runtime.
The runtime determines it's position in the job queue.
Here's the logic:
1. | public int | compareTo(Object je) Used for ordering Jobentries
Note: this comparator imposes orderings that are inconsistent with
equals.
Parameters: je - The first JobEntry object. | public String | getNextRunAsString() Get the next runtime for this job as a String. | public Date | getNextRunDate() | public long | getNextRuntime() Get the next runtime for this job as a long. | public boolean | isActive() | public void | setActive(boolean isActive) Sets whether the job is running. |
JobEntry | public JobEntry()(Code) | | default constructor
|
JobEntry | public JobEntry(int sec, int min, int hour, int wd, int day_mo, String task) throws TurbineException(Code) | | Constuctor.
Schedule a job to run on a certain point of time.
Example 1: Run the DefaultScheduledJob at 8:00am every 15th of
the month -
JobEntry je = new JobEntry(0,0,8,15,"DefaultScheduledJob");
Example 2: Run the DefaultScheduledJob at 8:00am every day -
JobEntry je = new JobEntry(0,0,8,-1,"DefaultScheduledJob");
Example 3: Run the DefaultScheduledJob every 2 hours. -
JobEntry je = new JobEntry(0,120,-1,-1,"DefaultScheduledJob");
Example 4: Run the DefaultScheduledJob every 30 seconds. -
JobEntry je = new JobEntry(30,-1,-1,-1,"DefaultScheduledJob");
Parameters: sec - Value for entry "seconds". Parameters: min - Value for entry "minutes". Parameters: hour - Value for entry "hours". Parameters: wd - Value for entry "week days". Parameters: day_mo - Value for entry "month days". Parameters: task - Task to execute. exception: TurbineException - a generic exception. |
calcRunTime | public void calcRunTime() throws TurbineException(Code) | | Calculate how long before the next runtime.
The runtime determines it's position in the job queue.
Here's the logic:
1. Create a date the represents when this job is to run.
2. If this date has expired, them "roll" appropriate date
fields forward to the next date.
3. Calculate the diff in time between the current time and the
next run time.
exception: TurbineException - a generic exception. |
compareTo | public int compareTo(Object je)(Code) | | Used for ordering Jobentries
Note: this comparator imposes orderings that are inconsistent with
equals.
Parameters: je - The first JobEntry object. An int indicating the result of the comparison. |
getNextRunAsString | public String getNextRunAsString()(Code) | | Get the next runtime for this job as a String.
The next run time as a String. |
getNextRunDate | public Date getNextRunDate()(Code) | | Gets the next runtime as a date
Next run date |
getNextRuntime | public long getNextRuntime()(Code) | | Get the next runtime for this job as a long.
The next run time as a long. |
isActive | public boolean isActive()(Code) | | Check to see if job is currently active/running
true if job is currently geing run by theworkerthread, otherwise false |
setActive | public void setActive(boolean isActive)(Code) | | Sets whether the job is running.
Parameters: isActive - Whether the job is running. |
|
|