📄 quartzscheduler.java
字号:
* on every group.
* </p>
*
* <p>
* When <code>resumeAll()</code> is called (to un-pause), trigger misfire
* instructions WILL be applied.
* </p>
*
* @see #resumeAll(SchedulingContext)
* @see #pauseTriggerGroup(SchedulingContext, String)
* @see #standby()
*/
public void pauseAll(SchedulingContext ctxt) throws SchedulerException {
validateState();
resources.getJobStore().pauseAll(ctxt);
notifySchedulerThread(0L);
notifySchedulerListenersPausedTrigger(null, null);
}
/**
* <p>
* Resume (un-pause) all triggers - equivalent of calling <code>resumeTriggerGroup(group)</code>
* on every group.
* </p>
*
* <p>
* If any <code>Trigger</code> missed one or more fire-times, then the
* <code>Trigger</code>'s misfire instruction will be applied.
* </p>
*
* @see #pauseAll(SchedulingContext)
*/
public void resumeAll(SchedulingContext ctxt) throws SchedulerException {
validateState();
resources.getJobStore().resumeAll(ctxt);
notifySchedulerThread(0L);
notifySchedulerListenersResumedTrigger(null, null);
}
/**
* <p>
* Get the names of all known <code>{@link org.quartz.Job}</code> groups.
* </p>
*/
public String[] getJobGroupNames(SchedulingContext ctxt)
throws SchedulerException {
validateState();
return resources.getJobStore().getJobGroupNames(ctxt);
}
/**
* <p>
* Get the names of all the <code>{@link org.quartz.Job}s</code> in the
* given group.
* </p>
*/
public String[] getJobNames(SchedulingContext ctxt, String groupName)
throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getJobNames(ctxt, groupName);
}
/**
* <p>
* Get all <code>{@link Trigger}</code> s that are associated with the
* identified <code>{@link org.quartz.JobDetail}</code>.
* </p>
*/
public Trigger[] getTriggersOfJob(SchedulingContext ctxt, String jobName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getTriggersForJob(ctxt, jobName,
groupName);
}
/**
* <p>
* Get the names of all known <code>{@link org.quartz.Trigger}</code>
* groups.
* </p>
*/
public String[] getTriggerGroupNames(SchedulingContext ctxt)
throws SchedulerException {
validateState();
return resources.getJobStore().getTriggerGroupNames(ctxt);
}
/**
* <p>
* Get the names of all the <code>{@link org.quartz.Trigger}s</code> in
* the given group.
* </p>
*/
public String[] getTriggerNames(SchedulingContext ctxt, String groupName)
throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getTriggerNames(ctxt, groupName);
}
/**
* <p>
* Get the <code>{@link JobDetail}</code> for the <code>Job</code>
* instance with the given name and group.
* </p>
*/
public JobDetail getJobDetail(SchedulingContext ctxt, String jobName,
String jobGroup) throws SchedulerException {
validateState();
if(jobGroup == null) {
jobGroup = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().retrieveJob(ctxt, jobName, jobGroup);
}
/**
* <p>
* Get the <code>{@link Trigger}</code> instance with the given name and
* group.
* </p>
*/
public Trigger getTrigger(SchedulingContext ctxt, String triggerName,
String triggerGroup) throws SchedulerException {
validateState();
if(triggerGroup == null) {
triggerGroup = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().retrieveTrigger(ctxt, triggerName,
triggerGroup);
}
/**
* <p>
* Get the current state of the identified <code>{@link Trigger}</code>.
* </p>
*
* @see Trigger#STATE_NORMAL
* @see Trigger#STATE_PAUSED
* @see Trigger#STATE_COMPLETE
* @see Trigger#STATE_ERROR
*/
public int getTriggerState(SchedulingContext ctxt, String triggerName,
String triggerGroup) throws SchedulerException {
validateState();
if(triggerGroup == null) {
triggerGroup = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getTriggerState(ctxt, triggerName,
triggerGroup);
}
/**
* <p>
* Add (register) the given <code>Calendar</code> to the Scheduler.
* </p>
*
* @throws SchedulerException
* if there is an internal Scheduler error, or a Calendar with
* the same name already exists, and <code>replace</code> is
* <code>false</code>.
*/
public void addCalendar(SchedulingContext ctxt, String calName,
Calendar calendar, boolean replace, boolean updateTriggers) throws SchedulerException {
validateState();
resources.getJobStore().storeCalendar(ctxt, calName, calendar, replace, updateTriggers);
}
/**
* <p>
* Delete the identified <code>Calendar</code> from the Scheduler.
* </p>
*
* @return true if the Calendar was found and deleted.
* @throws SchedulerException
* if there is an internal Scheduler error.
*/
public boolean deleteCalendar(SchedulingContext ctxt, String calName)
throws SchedulerException {
validateState();
return resources.getJobStore().removeCalendar(ctxt, calName);
}
/**
* <p>
* Get the <code>{@link Calendar}</code> instance with the given name.
* </p>
*/
public Calendar getCalendar(SchedulingContext ctxt, String calName)
throws SchedulerException {
validateState();
return resources.getJobStore().retrieveCalendar(ctxt, calName);
}
/**
* <p>
* Get the names of all registered <code>{@link Calendar}s</code>.
* </p>
*/
public String[] getCalendarNames(SchedulingContext ctxt)
throws SchedulerException {
validateState();
return resources.getJobStore().getCalendarNames(ctxt);
}
/**
* <p>
* Add the given <code>{@link org.quartz.JobListener}</code> to the
* <code>Scheduler</code>'s<i>global</i> list.
* </p>
*
* <p>
* Listeners in the 'global' list receive notification of execution events
* for ALL <code>{@link org.quartz.Job}</code>s.
* </p>
*/
public void addGlobalJobListener(JobListener jobListener) {
if (jobListener.getName() == null
|| jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (globalJobListeners) {
globalJobListeners.put(jobListener.getName(), jobListener);
}
}
/**
* <p>
* Add the given <code>{@link org.quartz.JobListener}</code> to the
* <code>Scheduler</code>'s list, of registered <code>JobListener</code>s.
*/
public void addJobListener(JobListener jobListener) {
if (jobListener.getName() == null
|| jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (jobListeners) {
jobListeners.put(jobListener.getName(), jobListener);
}
}
/**
* <p>
* Remove the given <code>{@link org.quartz.JobListener}</code> from the
* <code>Scheduler</code>'s list of <i>global</i> listeners.
* </p>
*
* @return true if the identifed listener was found in the list, and
* removed.
*
* @deprecated Use <code>{@link #removeGlobalJobListener(String)}</code>
*/
public boolean removeGlobalJobListener(JobListener jobListener) {
return removeGlobalJobListener((jobListener == null) ? null : jobListener.getName());
}
/**
* <p>
* Remove the identifed <code>{@link JobListener}</code> from the <code>Scheduler</code>'s
* list of <i>global</i> listeners.
* </p>
*
* @return true if the identifed listener was found in the list, and
* removed.
*/
public boolean removeGlobalJobListener(String name) {
synchronized (globalJobListeners) {
return (globalJobListeners.remove(name) != null);
}
}
/**
* <p>
* Remove the identifed <code>{@link org.quartz.JobListener}</code> from
* the <code>Scheduler</code>'s list of registered listeners.
* </p>
*
* @return true if the identifed listener was found in the list, and
* removed.
*/
public boolean removeJobListener(String name) {
synchronized (jobListeners) {
return (jobListeners.remove(name) != null);
}
}
/**
* <p>
* Get a List containing all of the <code>{@link org.quartz.JobListener}</code>
* s in the <code>Scheduler</code>'s<i>global</i> list.
* </p>
*/
public List getGlobalJobListeners() {
synchronized (globalJobListeners) {
return new LinkedList(globalJobListeners.values());
}
}
/**
* <p>
* Get a Set containing the names of all the <i>non-global</i><code>{@link org.quartz.JobListener}</code>
* s registered with the <code>Scheduler</code>.
* </p>
*/
public Set getJobListenerNames() {
synchronized (jobListeners) {
return new HashSet(jobListeners.keySet());
}
}
/**
* <p>
* Get the <i>global</i><code>{@link org.quartz.JobListener}</code>
* that has the given name.
* </p>
*/
public JobListener getGlobalJobListener(String name) {
synchronized (globalJobListeners) {
return (JobListener)globalJobListeners.get(name);
}
}
/**
* <p>
* Get the <i>non-global</i><code>{@link org.quartz.JobListener}</code>
* that has the given name.
* </p>
*/
public JobListener getJobListener(String name) {
synchronized (jobListeners) {
return (JobListener) jobListeners.get(name);
}
}
/**
* <p>
* Add the given <code>{@link org.quartz.TriggerListener}</code> to the
* <code>Scheduler</code>'s<i>global</i> list.
* </p>
*
* <p>
* Listeners in the 'global' list receive notification of execution events
* for ALL <code>{@link org.quartz.Trigger}</code>s.
* </p>
*/
public void addGlobalTriggerListener(TriggerListener triggerListener) {
if (triggerListener.getName() == null
|| triggerListener.getName().length() == 0) {
throw new IllegalArgumentException(
"TriggerListener name cannot be empty.");
}
synchronized (globalTriggerListeners) {
globalTriggerListeners.put(triggerListener.getName(), triggerListener);
}
}
/**
* <p>
* Add the given <code>{@link org.quartz.TriggerListener}</code> to the
* <code>Scheduler</code>'s list, of registered <code>TriggerListener</code>s.
*/
public void addTriggerListener(TriggerListener triggerListener) {
if (triggerListener.getName() == null
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -