|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.objectledge.scheduler.AbstractScheduler
public abstract class AbstractScheduler
Base class for scheduler components.
| Nested Class Summary | |
|---|---|
private class |
AbstractScheduler.RunnerTask
The worker task that runs a sheduled job. |
private class |
AbstractScheduler.SchedulerTask
The daemon task that performs the timekeeping |
| Field Summary | |
|---|---|
protected org.jcontainer.dna.Configuration |
config
the configuration. |
private org.picocontainer.MutablePicoContainer |
container
the container |
static String |
DATE_FORMAT_DEFAULT
The default DateFormat pattern used by the UI (yyy-MM-dd HH:mm). |
protected DateFormat |
format
The date format to be used for the UI. |
protected Map |
jobs
The registered jobs. |
protected org.jcontainer.dna.Logger |
logger
The logging facility. |
private SortedMap |
queue
The job queue. |
private Map |
runners
Runners of a specific job. |
private Map |
scheduleFactory
The registered schedule types factories. |
protected ThreadPool |
threadPool
The pool service. |
| Constructor Summary | |
|---|---|
AbstractScheduler(org.picocontainer.MutablePicoContainer container,
org.jcontainer.dna.Configuration config,
org.jcontainer.dna.Logger logger,
ThreadPool threadPool,
ScheduleFactory[] scheduleFactories)
Component contructor. |
|
| Method Summary | |
|---|---|
abstract boolean |
allowsModifications()
Returns true if the implemenation allows job manipulation at run time. |
abstract AbstractJobDescriptor |
createJobDescriptor(String name,
Schedule schedule,
String jobSpec)
Creates a new scheduled job. |
Schedule |
createSchedule(String type,
String config)
Creates a Schedule object. |
abstract void |
deleteJobDescriptor(AbstractJobDescriptor job)
Deletes a scheduled job. |
void |
disable(AbstractJobDescriptor job)
Disables a scheduled job. |
void |
enable(AbstractJobDescriptor job)
Enables a scheduled job. |
DateFormat |
getDateFormat()
Returns the DateFormat that should be used by the UI. |
AbstractJobDescriptor |
getJobDescriptor(String name)
Returns a configured job with the specified name. |
AbstractJobDescriptor[] |
getJobDescriptors()
Returns all currently configured jobs. |
(package private) Job |
getJobObject(AbstractJobDescriptor job)
Get job component. |
String[] |
getScheduleTypes()
Returns available schedule types. |
protected abstract void |
loadJobs()
Loads the jobs from storage / configuration. |
(package private) void |
run(AbstractJobDescriptor job)
Runs a specified job within a pool service's worker thread. |
(package private) void |
schedule(AbstractJobDescriptor job)
Schedules the next execution of a job. |
void |
start()
|
void |
stop()
|
private void |
terminate(AbstractJobDescriptor job)
Terminates execution of all instances of the job. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DATE_FORMAT_DEFAULT
private org.picocontainer.MutablePicoContainer container
protected org.jcontainer.dna.Configuration config
protected org.jcontainer.dna.Logger logger
protected ThreadPool threadPool
private Map scheduleFactory
protected Map jobs
private SortedMap queue
private Map runners
protected DateFormat format
| Constructor Detail |
|---|
public AbstractScheduler(org.picocontainer.MutablePicoContainer container,
org.jcontainer.dna.Configuration config,
org.jcontainer.dna.Logger logger,
ThreadPool threadPool,
ScheduleFactory[] scheduleFactories)
container - the container to store loaded classes.config - the configuration.logger - the logger.threadPool - the thread pool component.scheduleFactories - the list of schedule factories.| Method Detail |
|---|
public void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startable
public abstract AbstractJobDescriptor createJobDescriptor(String name,
Schedule schedule,
String jobSpec)
throws JobModificationException
Note that newly created jobs are initialy disabled. You need to call
enable(AbstractJobDescriptor)to allow the job's execution.
Non-perisistent implementation may decide to disallow creation of new jobs at run time. This
mehtod would throw UnsupportedOperationException in that case.
name - the name of the job.schedule - the job's schedule.jobSpec - job class specification, see
AbstractJobDescriptor.setJobClassName(String)
JobModificationException - if the job could not be instantiated.
public abstract void deleteJobDescriptor(AbstractJobDescriptor job)
throws JobModificationException
Non-persisten implementaion may decide to dissalow this operation.
job - the job.
JobModificationException - if the job could not be deleted.
public void enable(AbstractJobDescriptor job)
throws JobModificationException
job - the job.
JobModificationException - if the job state could not be saved.
public void disable(AbstractJobDescriptor job)
throws JobModificationException
An attempt will be made to terminate all instances of this job running at the moment. Would
this attempt be effective depends on the implementation of execute() and
terminate(Thread) methods in the Job class.
job - the job.
JobModificationException - if the job state could not be saved.public AbstractJobDescriptor[] getJobDescriptors()
public AbstractJobDescriptor getJobDescriptor(String name)
name - the job's name.
public String[] getScheduleTypes()
public Schedule createSchedule(String type,
String config)
throws InvalidScheduleException
type - the schedule type.config - the schedule configuration.
InvalidScheduleException - if schedule factory is not registerd.public abstract boolean allowsModifications()
true if the implemenation allows job manipulation at run time.
If this method returns false, the following methods are not supported, and
should not be called:
SchedulerService.createJob()SchedulerService.deleteJob()ScheduledJob.setSchedule()ScheduledJob.setJobSpec()ScheduledJob.setRunCountLimit()ScheduledJob.setTimeLimit()ScheduledJob.setReentrant()
true if the implemenation allows job manipulation at run time.public DateFormat getDateFormat()
protected abstract void loadJobs()
void schedule(AbstractJobDescriptor job)
job - the job.private void terminate(AbstractJobDescriptor job)
void run(AbstractJobDescriptor job)
job - the job.
Job getJobObject(AbstractJobDescriptor job)
throws JobNotFoundException
job - the job description.
JobNotFoundException - if job class not found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||