org.apache.turbine.services.schedule
Interface JobEntryInterface

All Superinterfaces:
Comparable<JobEntry>, org.apache.torque.om.Persistent

public interface JobEntryInterface
extends Comparable<JobEntry>, org.apache.torque.om.Persistent

This is a interface for a scheduled job. It does not specify how to configure when to run, that is left to subclasses. See the JobEntryTorque for an example of a JobEntry backed by Torque objects.

Version:
$Id: JobEntryInterface.java 1066938 2011-02-03 20:14:53Z ludwig $
Author:
Eric Pugh, Dave Bryson, Quinton McCombs

Method Summary
 void calcRunTime()
          Calculate how long before the next runtime.
 int compareTo(Object je)
          Used for ordering Jobentries Note: this comparator imposes orderings that are inconsistent with equals.
 String getNextRunAsString()
          Get the next runtime for this job as a String.
 Date getNextRunDate()
          Gets the next runtime as a date
 long getNextRuntime()
          Get the next runtime for this job as a long.
 String getTask()
          Get the Task
 boolean isActive()
          Check to see if job is currently active/running
 void setActive(boolean isActive)
          Sets whether the job is running.
 void setTask(String v)
          Set the value of Task
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.apache.torque.om.Persistent
getPrimaryKey, isModified, isNew, save, save, save, setModified, setNew, setPrimaryKey, setPrimaryKey
 

Method Detail

compareTo

int compareTo(Object je)
Used for ordering Jobentries Note: this comparator imposes orderings that are inconsistent with equals.

Parameters:
je - The first JobEntry object.
Returns:
An int indicating the result of the comparison.

setActive

void setActive(boolean isActive)
Sets whether the job is running.

Parameters:
isActive - Whether the job is running.

isActive

boolean isActive()
Check to see if job is currently active/running

Returns:
true if job is currently being run by the workerthread, otherwise false

getTask

String getTask()
Get the Task

Returns:
String

setTask

void setTask(String v)
Set the value of Task

Parameters:
v - new value

getNextRuntime

long getNextRuntime()
Get the next runtime for this job as a long.

Returns:
The next run time as a long.

getNextRunDate

Date getNextRunDate()
Gets the next runtime as a date

Returns:
Next run date

getNextRunAsString

String getNextRunAsString()
Get the next runtime for this job as a String.

Returns:
The next run time as a String.

calcRunTime

void calcRunTime()
                 throws TurbineException
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.

Throws:
TurbineException - a generic exception.


Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.