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

Inner classes inherited from class org.apache.turbine.services.schedule.TurbineSchedulerService
TurbineSchedulerService.MainLoop
 
Fields inherited from class org.apache.turbine.services.schedule.TurbineSchedulerService
mainLoop, scheduleQueue, thread
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.schedule.ScheduleService
SERVICE_NAME
 
Constructor Summary
TurbineNonPersistentSchedulerService()
          Constructor.
 
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 org.apache.turbine.services.schedule.TurbineSchedulerService
clearThread, getThread, listJobs, nextJob, restart, shutdown
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker
 

Constructor Detail

TurbineNonPersistentSchedulerService

public TurbineNonPersistentSchedulerService()
                                     throws java.lang.Exception
Constructor.
Throws:
Exception, - a generic exception.
Method Detail

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.
Overrides:
getJob in class TurbineSchedulerService
Parameters:
oid - The int id for the job.
Returns:
A JobEntry.
Throws:
Exception, - a generic exception.

addJob

public void addJob(JobEntry je)
            throws java.lang.Exception
Add a new job to the queue.
Overrides:
addJob in class TurbineSchedulerService
Parameters:
je - A JobEntry with the job to add.
Throws:
Exception, - a generic exception.

removeJob

public void removeJob(JobEntry je)
               throws java.lang.Exception
Remove a job from the queue.
Overrides:
removeJob in class TurbineSchedulerService
Parameters:
je - A JobEntry with the job to remove.
Throws:
Exception, - a generic exception.

updateJob

public void updateJob(JobEntry je)
               throws java.lang.Exception
Modify a Job.
Overrides:
updateJob in class TurbineSchedulerService
Parameters:
je - A JobEntry with the job to modify
Throws:
Exception, - a generic exception.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.