|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the main interface of a Quartz Scheduler.
A Scheduler
maintains a registery of
s and JobDetail
s. Once
registered, the Trigger
Scheduler
is responible for executing
Job
s when their associated Trigger
s fire (when
their scheduled time arrives).
Scheduler
instances are produced by a
. A scheduler that has already been
created/initialized can be found and used through the same factory that
produced it. After a SchedulerFactory
Scheduler
has been created, it must have
its start()
method called before it will fire any
Job
s.
Job
s are to be created by the 'client program', by defining
a class that implements the
interface.
JobDetail
objects are then created (also by the client)
to define a individual instances of the JobDetail
Job
.
JobDetail
instances can then be registered with the
Scheduler
via the scheduleJob(JobDetail, Trigger)
or addJob(JobDetail, boolean)
method.
Trigger
s can then be defined to fire individual
Job
instances based on given schedules.
SimpleTrigger
s are most useful for one-time firings, or firing
at an exact moment in time, with N repeats with a given delay between them.
CronTrigger
s allow scheduling based on time of day, day of week,
day of month, and month of year.
Job
s and Trigger
s have a name and group
associated with them, which should uniquely identify them within a single
. The 'group' feature may be useful for
creating logical groupings or categorizations of Scheduler
Jobs
s and
Triggers
s. If you don't have need for assigning a group to
a given Jobs
of Triggers
, then you can use the
DEFAULT_GROUP
constant defined on this interface.
Stored Job
s can also be 'manually' triggered through the use
of the triggerJob(String jobName, String jobGroup)
function.
Client programs may also be interested in the 'listener' interfaces that
are available from Quartz. The
interface
provides notifications of JobListener
Job
executions. The
interface provides notifications of
TriggerListener
Trigger
firings. The
interface provides notifications of SchedulerListener
Scheduler
events and
errors.
The setup/configuration of a Scheduler
instance is very
customizable. Please consult the documentation distributed with Quartz.
Job
,
JobDetail
,
Trigger
,
JobListener
,
TriggerListener
,
SchedulerListener
Field Summary | |
static java.lang.String |
DEFAULT_FAIL_OVER_GROUP
A constant Trigger group name used internally by the
scheduler - clients should not use the value of this constant
("FAILED_OVER_JOBS") for thename of a Trigger 's group. |
static java.lang.String |
DEFAULT_GROUP
A (possibly) usefull constant that can be used for specifying the group that Job and Trigger instances belong
to. |
static java.lang.String |
DEFAULT_MANUAL_TRIGGERS
A constant Trigger group name used internally by the
scheduler - clients should not use the value of this constant
("MANUAL_TRIGGER") for thename of a Trigger 's group. |
static java.lang.String |
DEFAULT_RECOVERY_GROUP
A constant Trigger group name used internally by the
scheduler - clients should not use the value of this constant
("RECOVERING_JOBS") for thename of a Trigger 's group. |
Method Summary | |
void |
addCalendar(java.lang.String calName,
Calendar calendar,
boolean replace)
Add (register) the given Calendar to the Scheduler. |
void |
addGlobalJobListener(JobListener jobListener)
Add the given to the
Scheduler 's global list. |
void |
addGlobalTriggerListener(TriggerListener triggerListener)
Add the given to the
Scheduler 's global list. |
void |
addJob(JobDetail jobDetail,
boolean replace)
Add the given Job to the Scheduler - with no associated
Trigger . |
void |
addJobListener(JobListener jobListener)
Add the given to the
Scheduler 's list, of registered JobListener s. |
void |
addSchedulerListener(SchedulerListener schedulerListener)
Register the given with the
Scheduler . |
void |
addTriggerListener(TriggerListener triggerListener)
Add the given to the
Scheduler 's list, of registered TriggerListener s. |
boolean |
deleteCalendar(java.lang.String calName)
Delete the identified Calendar from the Scheduler. |
boolean |
deleteJob(java.lang.String jobName,
java.lang.String groupName)
Delete the identified Job from the Scheduler - and any
associated Trigger s. |
Calendar |
getCalendar(java.lang.String calName)
Get the instance with the given
name. |
java.lang.String[] |
getCalendarNames()
Get the names of all registered . |
SchedulerContext |
getContext()
Returns the SchedulerContext of the
Scheduler . |
java.util.List |
getCurrentlyExecutingJobs()
Return a list of JobExecutionContext objects that
represent all currently executing Jobs. |
java.util.List |
getGlobalJobListeners()
Get a List containing all of the s
in the Scheduler 's global list. |
java.util.List |
getGlobalTriggerListeners()
Get a List containing all of the s
in the Scheduler 's global list. |
JobDetail |
getJobDetail(java.lang.String jobName,
java.lang.String jobGroup)
Get the for the Job
instance with the given name and group. |
java.lang.String[] |
getJobGroupNames()
Get the names of all known groups. |
JobListener |
getJobListener(java.lang.String name)
Get the non-global that has
the given name. |
java.util.Set |
getJobListenerNames()
Get a Set containing the names of all the non-global s registered with the
Scheduler . |
java.lang.String[] |
getJobNames(java.lang.String groupName)
Get the names of all the in the given
group. |
SchedulerMetaData |
getMetaData()
Get a SchedulerMetaData object describiing the settings
and capabilities of the scheduler instance. |
java.lang.String |
getSchedulerInstanceId()
Returns the instance Id of the Scheduler . |
java.util.List |
getSchedulerListeners()
Get a List containing all of the s
registered with the Scheduler . |
java.lang.String |
getSchedulerName()
Returns the name of the Scheduler . |
Trigger |
getTrigger(java.lang.String triggerName,
java.lang.String triggerGroup)
Get the instance with the given
name and group. |
java.lang.String[] |
getTriggerGroupNames()
Get the names of all known groups. |
TriggerListener |
getTriggerListener(java.lang.String name)
Get the non-global that
has the given name. |
java.util.Set |
getTriggerListenerNames()
Get a Set containing the names of all the non-global s registered with the
Scheduler . |
java.lang.String[] |
getTriggerNames(java.lang.String groupName)
Get the names of all the in the given
group. |
Trigger[] |
getTriggersOfJob(java.lang.String jobName,
java.lang.String groupName)
Get all s that are associated with the
identified . |
int |
getTriggerState(java.lang.String triggerName,
java.lang.String triggerGroup)
Get the current state of the identified . |
boolean |
isPaused()
Reports whether the Scheduler is paused. |
boolean |
isShutdown()
Reports whether the Scheduler has been shutdown. |
void |
pause()
Temporarily halts the Scheduler 's firing of
. |
void |
pauseAll()
Pause all triggers - equivalent of calling pauseTriggerGroup(group) on every group. |
void |
pauseJob(java.lang.String jobName,
java.lang.String groupName)
Pause the with the given name - by pausing
all of its current Trigger s. |
void |
pauseJobGroup(java.lang.String groupName)
Pause all of the in the given group - by
pausing all of their Trigger s. |
void |
pauseTrigger(java.lang.String triggerName,
java.lang.String groupName)
Pause the with the given name. |
void |
pauseTriggerGroup(java.lang.String groupName)
Pause all of the in the given group. |
boolean |
removeGlobalJobListener(JobListener jobListener)
Remove the given from the
Scheduler 's list of global listeners. |
boolean |
removeGlobalTriggerListener(TriggerListener triggerListener)
Remove the given from the
Scheduler 's list of global listeners. |
boolean |
removeJobListener(java.lang.String name)
Remove the identifed from the
Scheduler 's list of registered listeners. |
boolean |
removeSchedulerListener(SchedulerListener schedulerListener)
Remove the given from the
Scheduler . |
boolean |
removeTriggerListener(java.lang.String name)
Remove the identifed from the
Scheduler 's list of registered listeners. |
void |
resumeAll()
Resume (un-pause) all triggers - equivalent of calling resumeTriggerGroup(group) on every group. |
void |
resumeJob(java.lang.String jobName,
java.lang.String groupName)
Resume (un-pause) the with the given
name. |
void |
resumeJobGroup(java.lang.String groupName)
Resume (un-pause) all of the in the given
group. |
void |
resumeTrigger(java.lang.String triggerName,
java.lang.String groupName)
Resume (un-pause) the with the given
name. |
void |
resumeTriggerGroup(java.lang.String groupName)
Resume (un-pause) all of the in the given
group. |
java.util.Date |
scheduleJob(JobDetail jobDetail,
Trigger trigger)
Add the given to the Scheduler, and associate
the given with it. |
java.util.Date |
scheduleJob(Trigger trigger)
Schedule the given with the
Job identified by the Trigger 's settings. |
void |
shutdown()
Halts the Scheduler 's firing of
, and cleans up all resources associated
with the Scheduler. |
void |
shutdown(boolean waitForJobsToComplete)
Halts the Scheduler 's firing of
, and cleans up all resources associated
with the Scheduler. |
void |
start()
Starts the Scheduler 's threads that fire
. |
void |
triggerJob(java.lang.String jobName,
java.lang.String groupName)
Trigger the identified (execute it now) -
the generated trigger will be non-volatile. |
void |
triggerJobWithVolatileTrigger(java.lang.String jobName,
java.lang.String groupName)
Trigger the identified (execute it now) -
the generated trigger will be volatile. |
boolean |
unscheduleJob(java.lang.String triggerName,
java.lang.String groupName)
Remove the indicated from the scheduler. |
Field Detail |
public static final java.lang.String DEFAULT_GROUP
A (possibly) usefull constant that can be used for specifying the
group that Job
and Trigger
instances belong
to.
public static final java.lang.String DEFAULT_MANUAL_TRIGGERS
A constant Trigger
group name used internally by the
scheduler - clients should not use the value of this constant
("MANUAL_TRIGGER") for thename of a Trigger
's group.
public static final java.lang.String DEFAULT_RECOVERY_GROUP
A constant Trigger
group name used internally by the
scheduler - clients should not use the value of this constant
("RECOVERING_JOBS") for thename of a Trigger
's group.
public static final java.lang.String DEFAULT_FAIL_OVER_GROUP
A constant Trigger
group name used internally by the
scheduler - clients should not use the value of this constant
("FAILED_OVER_JOBS") for thename of a Trigger
's group.
Method Detail |
public java.lang.String getSchedulerName() throws SchedulerException
Returns the name of the Scheduler
.
SchedulerException
public java.lang.String getSchedulerInstanceId() throws SchedulerException
Returns the instance Id of the Scheduler
.
SchedulerException
public SchedulerContext getContext() throws SchedulerException
Returns the SchedulerContext
of the
Scheduler
.
SchedulerException
public void start() throws SchedulerException
Starts the Scheduler
's threads that fire
.Trigger
s
All
that have misfired will be passed to
the appropriate TriggerListener(s).Trigger
s
SchedulerException
- if close()
has been called, or
there is an error within the Scheduler
.pause()
,
shutdown()
public void pause() throws SchedulerException
Temporarily halts the Scheduler
's firing of
.Trigger
s
When start()
is called (to un-pause), trigger misfire
instructions will NOT be applied.
The scheduler is not destroyed, and can be re-started at any time.
SchedulerException
start()
,
pauseAll()
public boolean isPaused() throws SchedulerException
Reports whether the Scheduler
is paused.
SchedulerException
public void shutdown() throws SchedulerException
Halts the Scheduler
's firing of
, and cleans up all resources associated
with the Scheduler. Equivalent to Trigger
sshutdown(false)
.
The scheduler cannot be re-started.
SchedulerException
shutdown(boolean)
public void shutdown(boolean waitForJobsToComplete) throws SchedulerException
Halts the Scheduler
's firing of
, and cleans up all resources associated
with the Scheduler.Trigger
s
The scheduler cannot be re-started.
waitForJobsToComplete
- if true
the scheduler will not
allow this method to return until all currently executing jobs have
completed.
SchedulerException
shutdown()
public boolean isShutdown() throws SchedulerException
Reports whether the Scheduler
has been shutdown.
SchedulerException
public SchedulerMetaData getMetaData() throws SchedulerException
Get a SchedulerMetaData
object describiing the settings
and capabilities of the scheduler instance.
Note that the data returned is an 'instantaneous' snap-shot, and that as soon as it's returned, the meta data values may be different.
SchedulerException
public java.util.List getCurrentlyExecutingJobs() throws SchedulerException
Return a list of JobExecutionContext
objects that
represent all currently executing Jobs.
Note that the list returned is an 'instantaneous' snap-shot, and that
as soon as it's returned, the true list of executing jobs may be
different. Also please read the doc associated with
JobExecutionContext
- especially if you're using RMI.
SchedulerException
JobExecutionContext
public java.util.Date scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException
Add the given
to the Scheduler, and associate
the given JobDetail
with it.Trigger
If the given Trigger does not reference any Job
, then it
will be set to reference the Job passed with it into this method.
SchedulerException
- if the Job or Trigger cannot be added to the
Scheduler, or there is an internal Scheduler error.public java.util.Date scheduleJob(Trigger trigger) throws SchedulerException
Schedule the given
with the
Trigger
Job
identified by the Trigger
's settings.
SchedulerException
- if the indicated Job does not exist, or the
Trigger cannot be added to the Scheduler, or there is an internal
Scheduler error.public boolean unscheduleJob(java.lang.String triggerName, java.lang.String groupName) throws SchedulerException
Remove the indicated
from the scheduler.Trigger
SchedulerException
public void addJob(JobDetail jobDetail, boolean replace) throws SchedulerException
Add the given Job
to the Scheduler - with no associated
Trigger
. The Job
will be 'dormant' until it is
scheduled with a Trigger
, or
Scheduler.triggerJob()
is called for it.
The Job
must by definition be 'durable', if it is not,
SchedulerException will be thrown.
SchedulerException
- if there is an internal Scheduler error, or if
the Job is not durable, or a Job with the same name already exists, and
replace
is false
.public boolean deleteJob(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
Delete the identified Job
from the Scheduler - and any
associated Trigger
s.
SchedulerException
- if there is an internal Scheduler error.public void triggerJob(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
Trigger the identified
(execute it now) -
the generated trigger will be non-volatile.JobDetail
SchedulerException
public void triggerJobWithVolatileTrigger(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
Trigger the identified
(execute it now) -
the generated trigger will be volatile.JobDetail
SchedulerException
public void pauseJob(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
Pause the
with the given name - by pausing
all of its current JobDetail
Trigger
s.
SchedulerException
resumeJob(String, String)
public void pauseJobGroup(java.lang.String groupName) throws SchedulerException
Pause all of the
in the given group - by
pausing all of their JobDetail
sTrigger
s.
The Scheduler will "remember" that the group is paused, and impose the pause on any new jobs that are added to the group while the group is paused.
SchedulerException
resumeJobGroup(String)
public void pauseTrigger(java.lang.String triggerName, java.lang.String groupName) throws SchedulerException
Pause the
with the given name.Trigger
SchedulerException
resumeTrigger(String, String)
public void pauseTriggerGroup(java.lang.String groupName) throws SchedulerException
Pause all of the
in the given group.Trigger
s
The Scheduler will "remember" that the group is paused, and impose the pause on any new triggers that are added to the group while the group is paused.
SchedulerException
resumeTriggerGroup(String)
public void resumeJob(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
Resume (un-pause) the
with the given
name.JobDetail
If any of the Job
's Trigger
s missed one or
more fire-times, then the Trigger
's misfire instruction will
be applied.
SchedulerException
pauseJob(String, String)
public void resumeJobGroup(java.lang.String groupName) throws SchedulerException
Resume (un-pause) all of the
in the given
group.JobDetail
s
If any of the Job
s had Trigger
s that missed
one or more fire-times, then the Trigger
's misfire
instruction will be applied.
SchedulerException
pauseJobGroup(String)
public void resumeTrigger(java.lang.String triggerName, java.lang.String groupName) throws SchedulerException
Resume (un-pause) the
with the given
name.Trigger
If the Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
SchedulerException
pauseTrigger(String, String)
public void resumeTriggerGroup(java.lang.String groupName) throws SchedulerException
Resume (un-pause) all of the
in the given
group.Trigger
s
If any Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
SchedulerException
pauseTriggerGroup(String)
public void pauseAll() throws SchedulerException
Pause all triggers - equivalent of calling
pauseTriggerGroup(group)
on every group.
When resumeAll()
is called (to un-pause), trigger misfire
instructions WILL be applied.
SchedulerException
resumeAll()
,
pauseTriggerGroup(String)
,
pause()
public void resumeAll() throws SchedulerException
Resume (un-pause) all triggers - equivalent of calling
resumeTriggerGroup(group)
on every group.
If any Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
SchedulerException
pauseAll()
public java.lang.String[] getJobGroupNames() throws SchedulerException
Get the names of all known
groups.JobDetail
SchedulerException
public java.lang.String[] getJobNames(java.lang.String groupName) throws SchedulerException
Get the names of all the
in the given
group.JobDetail
s
SchedulerException
public Trigger[] getTriggersOfJob(java.lang.String jobName, java.lang.String groupName) throws SchedulerException
public java.lang.String[] getTriggerGroupNames() throws SchedulerException
Get the names of all known
groups.Trigger
SchedulerException
public java.lang.String[] getTriggerNames(java.lang.String groupName) throws SchedulerException
Get the names of all the
in the given
group.Trigger
s
SchedulerException
public JobDetail getJobDetail(java.lang.String jobName, java.lang.String jobGroup) throws SchedulerException
Get the
for the JobDetail
Job
instance with the given name and group.
SchedulerException
public Trigger getTrigger(java.lang.String triggerName, java.lang.String triggerGroup) throws SchedulerException
Get the
instance with the given
name and group.Trigger
SchedulerException
public int getTriggerState(java.lang.String triggerName, java.lang.String triggerGroup) throws SchedulerException
Get the current state of the identified
.Trigger
SchedulerException
Trigger.STATE_NORMAL
,
Trigger.STATE_PAUSED
,
Trigger.STATE_COMPLETE
,
Trigger.STATE_ERROR
,
Trigger.STATE_NONE
public void addCalendar(java.lang.String calName, Calendar calendar, boolean replace) throws SchedulerException
Add (register) the given Calendar
to the Scheduler.
SchedulerException
- if there is an internal Scheduler error, or
a Calendar with the same name already exists, and replace
is
false
.public boolean deleteCalendar(java.lang.String calName) throws SchedulerException
Delete the identified Calendar
from the Scheduler.
SchedulerException
- if there is an internal Scheduler error.public Calendar getCalendar(java.lang.String calName) throws SchedulerException
Get the
instance with the given
name.Calendar
SchedulerException
public java.lang.String[] getCalendarNames() throws SchedulerException
Get the names of all registered
.Calendar
s
SchedulerException
public void addGlobalJobListener(JobListener jobListener) throws SchedulerException
Add the given
to the
JobListener
Scheduler
's global list.
Listeners in the 'global' list receive notification of execution
events for ALL
s.JobDetail
SchedulerException
public void addJobListener(JobListener jobListener) throws SchedulerException
Add the given
to the
JobListener
Scheduler
's list, of registered JobListener
s.
SchedulerException
public boolean removeGlobalJobListener(JobListener jobListener) throws SchedulerException
Remove the given
from the
JobListener
Scheduler
's list of global listeners.
SchedulerException
public boolean removeJobListener(java.lang.String name) throws SchedulerException
Remove the identifed
from the
JobListener
Scheduler
's list of registered listeners.
SchedulerException
public java.util.List getGlobalJobListeners() throws SchedulerException
Get a List containing all of the
s
in the JobListener
Scheduler
's global list.
SchedulerException
public java.util.Set getJobListenerNames() throws SchedulerException
Get a Set containing the names of all the non-global
s registered with the
JobListener
Scheduler
.
SchedulerException
public JobListener getJobListener(java.lang.String name) throws SchedulerException
Get the non-global
that has
the given name.JobListener
SchedulerException
public void addGlobalTriggerListener(TriggerListener triggerListener) throws SchedulerException
Add the given
to the
TriggerListener
Scheduler
's global list.
Listeners in the 'global' list receive notification of execution
events for ALL
s.Trigger
SchedulerException
public void addTriggerListener(TriggerListener triggerListener) throws SchedulerException
Add the given
to the
TriggerListener
Scheduler
's list, of registered TriggerListener
s.
SchedulerException
public boolean removeGlobalTriggerListener(TriggerListener triggerListener) throws SchedulerException
Remove the given
from the
TriggerListener
Scheduler
's list of global listeners.
SchedulerException
public boolean removeTriggerListener(java.lang.String name) throws SchedulerException
Remove the identifed
from the
TriggerListener
Scheduler
's list of registered listeners.
SchedulerException
public java.util.List getGlobalTriggerListeners() throws SchedulerException
Get a List containing all of the
s
in the TriggerListener
Scheduler
's global list.
SchedulerException
public java.util.Set getTriggerListenerNames() throws SchedulerException
Get a Set containing the names of all the non-global
s registered with the
TriggerListener
Scheduler
.
SchedulerException
public TriggerListener getTriggerListener(java.lang.String name) throws SchedulerException
Get the non-global
that
has the given name.TriggerListener
SchedulerException
public void addSchedulerListener(SchedulerListener schedulerListener) throws SchedulerException
Register the given
with the
SchedulerListener
Scheduler
.
SchedulerException
public boolean removeSchedulerListener(SchedulerListener schedulerListener) throws SchedulerException
Remove the given
from the
SchedulerListener
Scheduler
.
SchedulerException
public java.util.List getSchedulerListeners() throws SchedulerException
Get a List containing all of the
s
registered with the SchedulerListener
Scheduler
.
SchedulerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |