org.apache.turbine.services.schedule
Class TurbineNonPersistentSchedulerService
java.lang.Object
|
+--org.apache.turbine.services.BaseInitable
|
+--org.apache.turbine.services.BaseService
|
+--org.apache.turbine.services.TurbineBaseService
|
+--org.apache.turbine.services.schedule.TurbineSchedulerService
|
+--org.apache.turbine.services.schedule.TurbineNonPersistentSchedulerService
- All Implemented Interfaces:
- Initable, ScheduleService, Service
- public class TurbineNonPersistentSchedulerService
- extends TurbineSchedulerService
Service for a cron like scheduler that uses the
TurbineResources.properties file instead of the database.
The methods that operate on jobs ( get,add,update,remove )
only operate on the queue in memory and changes are not reflected
to the properties file which was used to initilize the jobs.
An example is given below. The job names are the class names that
extend ScheduledJob.
scheduler.jobs=scheduledJobName,scheduledJobName2
scheduler.job.scheduledJobName.ID=1
scheduler.job.scheduledJobName.SECOND=-1
scheduler.job.scheduledJobName.MINUTE=-1
scheduler.job.scheduledJobName.HOUR=7
scheduler.job.scheduledJobName.WEEKDAY=-1
scheduler.job.scheduledJobName.DAY_OF_MONTH=-1
scheduler.job.scheduledJobName2.ID=1
scheduler.job.scheduledJobName2.SECOND=-1
scheduler.job.scheduledJobName2.MINUTE=-1
scheduler.job.scheduledJobName2.HOUR=7
scheduler.job.scheduledJobName2.WEEKDAY=-1
scheduler.job.scheduledJobName2.DAY_OF_MONTH=-1
Based on TamboraSchedulerService written by John Thorhauer.
- Author:
- Jeff Brekke, John Thorhauer
|
Method Summary |
void |
addJob(JobEntry je)
Add a new job to the queue. |
JobEntry |
getJob(int oid)
This method returns the job element from the internal queue. |
void |
init(javax.servlet.ServletConfig config)
Called the first time the Service is used.
Load all the jobs from cold storage. |
void |
removeJob(JobEntry je)
Remove a job from the queue. |
void |
updateJob(JobEntry je)
Modify a Job. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TurbineNonPersistentSchedulerService
public TurbineNonPersistentSchedulerService()
throws java.lang.Exception
- Constructor.
- Throws:
Exception, - a generic exception.
java.lang.Exception
init
public void init(javax.servlet.ServletConfig config)
- Called the first time the Service is used.
Load all the jobs from cold storage. Add jobs to the queue
(sorted in ascending order by runtime) and start the scheduler
thread.
- Overrides:
init in class TurbineSchedulerService
- Parameters:
config - A ServletConfig.
getJob
public JobEntry getJob(int oid)
throws java.lang.Exception
- This method returns the job element from the internal queue.
- Specified by:
getJob in interface ScheduleService- Overrides:
getJob in class TurbineSchedulerService
- Parameters:
oid - The int id for the job.
- Returns:
- A JobEntry.
- Throws:
Exception, - a generic exception.
java.lang.Exception
addJob
public void addJob(JobEntry je)
throws java.lang.Exception
- Add a new job to the queue.
- Specified by:
addJob in interface ScheduleService- Overrides:
addJob in class TurbineSchedulerService
- Parameters:
je - A JobEntry with the job to add.
- Throws:
Exception, - a generic exception.
java.lang.Exception
removeJob
public void removeJob(JobEntry je)
throws java.lang.Exception
- Remove a job from the queue.
- Specified by:
removeJob in interface ScheduleService- Overrides:
removeJob in class TurbineSchedulerService
- Parameters:
je - A JobEntry with the job to remove.
- Throws:
Exception, - a generic exception.
java.lang.Exception
updateJob
public void updateJob(JobEntry je)
throws java.lang.Exception
- Modify a Job.
- Specified by:
updateJob in interface ScheduleService- Overrides:
updateJob in class TurbineSchedulerService
- Parameters:
je - A JobEntry with the job to modify
- Throws:
Exception, - a generic exception.
java.lang.Exception
Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.