📄 quartzscheduler.java
字号:
trig.setVolatility(true); trig.computeFirstFireTime(null); boolean collision = true; while (collision) { try { resources.getJobStore().storeTrigger(ctxt, trig, false); collision = false; } catch (ObjectAlreadyExistsException oaee) { trig.setName(newTriggerId()); } } notifySchedulerThread(); notifySchedulerListenersSchduled(trig); } /** * <p> * Pause the <code>{@link Trigger}</code> with the given name. * </p> * */ public void pauseTrigger(SchedulingContext ctxt, String triggerName, String groupName) throws SchedulerException { validateState(); resources.getJobStore().pauseTrigger(ctxt, triggerName, groupName); notifySchedulerThread(); notifySchedulerListenersPausedTrigger(triggerName, groupName); } /** * <p> * Pause all of the <code>{@link Trigger}s</code> in the given group. * </p> * */ public void pauseTriggerGroup(SchedulingContext ctxt, String groupName) throws SchedulerException { validateState(); resources.getJobStore().pauseTriggerGroup(ctxt, groupName); notifySchedulerThread(); notifySchedulerListenersPausedTrigger(null, groupName); } /** * <p> * Pause the <code>{@link org.quartz.JobDetail}</code> with the given * name - by pausing all of its current <code>Trigger</code>s. * </p> * */ public void pauseJob(SchedulingContext ctxt, String jobName, String groupName) throws SchedulerException { validateState(); resources.getJobStore().pauseJob(ctxt, jobName, groupName); notifySchedulerThread(); notifySchedulerListenersPausedJob(jobName, groupName); } /** * <p> * Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the * given group - by pausing all of their <code>Trigger</code>s. * </p> * */ public void pauseJobGroup(SchedulingContext ctxt, String groupName) throws SchedulerException { validateState(); resources.getJobStore().pauseJobGroup(ctxt, groupName); notifySchedulerThread(); notifySchedulerListenersPausedJob(null, groupName); } /** * <p> * Resume (un-pause) the <code>{@link Trigger}</code> with the given * name. * </p> * * <p> * If the <code>Trigger</code> missed one or more fire-times, then the * <code>Trigger</code>'s misfire instruction will be applied. * </p> * */ public void resumeTrigger(SchedulingContext ctxt, String triggerName, String groupName) throws SchedulerException { validateState(); resources.getJobStore().resumeTrigger(ctxt, triggerName, groupName); notifySchedulerThread(); notifySchedulerListenersResumedTrigger(triggerName, groupName); } /** * <p> * Resume (un-pause) all of the <code>{@link Trigger}s</code> in the * given 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> * */ public void resumeTriggerGroup(SchedulingContext ctxt, String groupName) throws SchedulerException { validateState(); resources.getJobStore().resumeTriggerGroup(ctxt, groupName); notifySchedulerThread(); notifySchedulerListenersResumedTrigger(null, groupName); } public Set getPausedTriggerGroups(SchedulingContext ctxt) throws SchedulerException { return resources.getJobStore().getPausedTriggerGroups(ctxt); } /** * <p> * Resume (un-pause) the <code>{@link org.quartz.JobDetail}</code> with * the given name. * </p> * * <p> * If any of the <code>Job</code>'s<code>Trigger</code> s missed one * or more fire-times, then the <code>Trigger</code>'s misfire * instruction will be applied. * </p> * */ public void resumeJob(SchedulingContext ctxt, String jobName, String groupName) throws SchedulerException { validateState(); resources.getJobStore().resumeJob(ctxt, jobName, groupName); notifySchedulerThread(); notifySchedulerListenersResumedJob(jobName, groupName); } /** * <p> * Resume (un-pause) all of the <code>{@link org.quartz.JobDetail}s</code> * in the given group. * </p> * * <p> * If any of the <code>Job</code> s had <code>Trigger</code> s that * missed one or more fire-times, then the <code>Trigger</code>'s * misfire instruction will be applied. * </p> * */ public void resumeJobGroup(SchedulingContext ctxt, String groupName) throws SchedulerException { validateState(); resources.getJobStore().resumeJobGroup(ctxt, groupName); notifySchedulerThread(); notifySchedulerListenersResumedJob(null, groupName); } /** * <p> * Pause all triggers - equivalent of calling <code>pauseTriggerGroup(group)</code> * 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 #pause() */ public void pauseAll(SchedulingContext ctxt) throws SchedulerException { validateState(); resources.getJobStore().pauseAll(ctxt); notifySchedulerThread(); 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(); 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(); 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(); 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(); 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(); 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(); 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(); 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -