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.
services.SchedulerService.scheduler.jobs=scheduledJobName,scheduledJobName2
services.SchedulerService.scheduler.job.scheduledJobName.ID=1
services.SchedulerService.scheduler.job.scheduledJobName.SECOND=-1
services.SchedulerService.scheduler.job.scheduledJobName.MINUTE=-1
services.SchedulerService.scheduler.job.scheduledJobName.HOUR=7
services.SchedulerService.scheduler.job.scheduledJobName.WEEKDAY=-1
services.SchedulerService.scheduler.job.scheduledJobName.DAY_OF_MONTH=-1
services.SchedulerService.scheduler.job.scheduledJobName2.ID=1
services.SchedulerService.scheduler.job.scheduledJobName2.SECOND=-1
services.SchedulerService.scheduler.job.scheduledJobName2.MINUTE=-1
services.SchedulerService.scheduler.job.scheduledJobName2.HOUR=7
services.SchedulerService.scheduler.job.scheduledJobName2.WEEKDAY=-1
services.SchedulerService.scheduler.job.scheduledJobName2.DAY_OF_MONTH=-1
Based on TamboraSchedulerService written by John Thorhauer.
- Version:
- $Id: TurbineNonPersistentSchedulerService.java 264148 2005-08-29 14:21:04Z henning $
- Author:
- Jeff Brekke, John Thorhauer, Quinton McCombs
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()
Called the first time the Service is used.
Load all the jobs from cold storage. |
void |
init(javax.servlet.ServletConfig config)
Deprecated. use init() instead. |
void |
removeJob(JobEntry je)
Remove a job from the queue. |
void |
updateJob(JobEntry je)
Add/update a job |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TurbineNonPersistentSchedulerService
public TurbineNonPersistentSchedulerService()
throws TurbineException
- Constructor.
- Throws:
TurbineException
- a generic exception.
init
public void init()
throws InitializationException
- 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.
- Specified by:
init
in interface Initable
- Overrides:
init
in class TurbineSchedulerService
- Throws:
InitializationException
- Something went wrong in the init
stage
init
public void init(javax.servlet.ServletConfig config)
throws InitializationException
- Deprecated. use init() instead.
- 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.
- Throws:
InitializationException
getJob
public JobEntry getJob(int oid)
throws TurbineException
- 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:
TurbineException
- could not retrieve job
addJob
public void addJob(JobEntry je)
throws TurbineException
- 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:
TurbineException
- job could not be added
removeJob
public void removeJob(JobEntry je)
- 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.
updateJob
public void updateJob(JobEntry je)
throws TurbineException
- Add/update a job
- Specified by:
updateJob
in interface ScheduleService
- Overrides:
updateJob
in class TurbineSchedulerService
- Parameters:
je
- A JobEntry with the job to modify
- Throws:
TurbineException
- job could not be updated
Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.