| java.lang.Object org.apache.jetspeed.scheduler.BaseJobEntry org.apache.jetspeed.scheduler.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.
author: Dave Bryson version: $Id: JobEntry.java 516448 2007-03-09 16:25:47Z ate $ |
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) | public String | getNextRunAsString() Get the next runtime for this job as a String. | 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 Exception(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: Exception - , a generic exception. |
calcRunTime | public void calcRunTime() throws Exception(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: Exception - , a generic exception. |
compareTo | public int compareTo(Object je)(Code) | | Compares one JobEntry to another JobEntry based on the JobId
|
getNextRunAsString | public String getNextRunAsString()(Code) | | Get the next runtime for this job as a String.
The next run time as a String. |
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. |
|
|