|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.schedule.TurbineSchedulerService
public class TurbineSchedulerService
Service for a cron like scheduler.
Nested Class Summary | |
---|---|
protected class |
TurbineSchedulerService.MainLoop
Inner class. |
Field Summary | |
---|---|
protected boolean |
enabled
Current status of the scheduler |
protected static org.apache.commons.logging.Log |
log
Logging |
protected TurbineSchedulerService.MainLoop |
mainLoop
The main loop for starting jobs. |
protected JobQueue |
scheduleQueue
The queue |
protected Thread |
thread
The thread used to process commands. |
Fields inherited from class org.apache.turbine.services.BaseService |
---|
configuration, name, serviceBroker |
Fields inherited from class org.apache.turbine.services.BaseInitable |
---|
initableBroker, isInitialized |
Fields inherited from interface org.apache.turbine.services.schedule.ScheduleService |
---|
INTIALLY_ACTIVE, LOGGER_NAME, SERVICE_NAME |
Constructor Summary | |
---|---|
TurbineSchedulerService()
Creates a new instance. |
Method Summary | |
---|---|
void |
addJob(JobEntry je)
Add a new job to the queue. |
protected void |
clearThread()
Set thread to null to indicate termination. |
JobEntry |
getJob(int oid)
Get a specific Job from Storage. |
Thread |
getThread()
Return the thread being used to process commands, or null if there is no such thread. |
void |
init()
Initializes the SchedulerService. |
void |
init(javax.servlet.ServletConfig config)
Deprecated. use init() instead. |
boolean |
isEnabled()
Determines if the scheduler service is currently enabled. |
List<JobEntry> |
listJobs()
List jobs in the queue. |
protected JobEntry |
nextJob()
Return the next Job to execute, or null if thread is interrupted. |
void |
removeJob(JobEntry je)
Remove a job from the queue. |
void |
restart()
Start (or restart) a thread to process commands, or wake up an existing thread if one is already running. |
protected void |
setEnabled(boolean enabled)
Sets the enabled status of the scheduler |
void |
shutdown()
Shutdowns the service. |
void |
startScheduler()
Starts or restarts the scheduler if not already running. |
void |
stopScheduler()
Stops the scheduler if it is currently running. |
void |
updateJob(JobEntry je)
Add or update a job. |
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, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.Service |
---|
getConfiguration, getName, getProperties, setName, setServiceBroker |
Methods inherited from interface org.apache.turbine.services.Initable |
---|
getInit, init, setInitableBroker |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
protected JobQueue scheduleQueue
protected boolean enabled
protected TurbineSchedulerService.MainLoop mainLoop
protected Thread thread
Constructor Detail |
---|
public TurbineSchedulerService()
Method Detail |
---|
public void init() throws InitializationException
init
in interface Initable
init
in class TurbineBaseService
InitializationException
- Something went wrong in the init
stage@Deprecated public void init(javax.servlet.ServletConfig config) throws InitializationException
config
- A ServletConfig.
InitializationException
public void shutdown()
shutdown
in interface Initable
shutdown
in class TurbineBaseService
public JobEntry getJob(int oid) throws TurbineException
getJob
in interface ScheduleService
oid
- The int id for the job.
TurbineException
- job could not be retreived.public void addJob(JobEntry je) throws TurbineException
addJob
in interface ScheduleService
je
- A JobEntry with the job to add.
TurbineException
- job could not be addedpublic void removeJob(JobEntry je) throws TurbineException
removeJob
in interface ScheduleService
je
- A JobEntry with the job to remove.
TurbineException
- job could not be removedpublic void updateJob(JobEntry je) throws TurbineException
updateJob
in interface ScheduleService
je
- A JobEntry with the job to modify
TurbineException
- job could not be updatedpublic List<JobEntry> listJobs()
listJobs
in interface ScheduleService
protected void setEnabled(boolean enabled)
enabled
- public boolean isEnabled()
isEnabled
in interface ScheduleService
public void startScheduler()
startScheduler
in interface ScheduleService
public void stopScheduler()
stopScheduler
in interface ScheduleService
public Thread getThread()
protected void clearThread()
public void restart()
protected JobEntry nextJob() throws TurbineException
TurbineException
- a generic exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |