| Method from org.quartz.core.QuartzScheduler Detail: |
public void addCalendar(SchedulingContext ctxt,
String calName,
Calendar calendar,
boolean replace,
boolean updateTriggers) throws SchedulerException {
validateState();
resources.getJobStore().storeCalendar(ctxt, calName, calendar, replace, updateTriggers);
}
|
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);
}
}
|
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);
}
}
|
public void addJob(SchedulingContext ctxt,
JobDetail jobDetail,
boolean replace) throws SchedulerException {
validateState();
if (!jobDetail.isDurable() && !replace) {
throw new SchedulerException(
"Jobs added with no trigger must be durable.",
SchedulerException.ERR_CLIENT_ERROR);
}
resources.getJobStore().storeJob(ctxt, jobDetail, replace);
}
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.
|
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);
}
}
|
public void addNoGCObject(Object obj) {
holdToPreventGC.add(obj);
}
|
public void addSchedulerListener(SchedulerListener schedulerListener) {
synchronized (schedulerListeners) {
schedulerListeners.add(schedulerListener);
}
}
|
public void addTriggerListener(TriggerListener triggerListener) {
if (triggerListener.getName() == null
|| triggerListener.getName().length() == 0) {
throw new IllegalArgumentException(
"TriggerListener name cannot be empty.");
}
synchronized (triggerListeners) {
triggerListeners.put(triggerListener.getName(), triggerListener);
}
}
|
public boolean deleteCalendar(SchedulingContext ctxt,
String calName) throws SchedulerException {
validateState();
return resources.getJobStore().removeCalendar(ctxt, calName);
}
|
public boolean deleteJob(SchedulingContext ctxt,
String jobName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().removeJob(ctxt, jobName, groupName);
}
|
public Calendar getCalendar(SchedulingContext ctxt,
String calName) throws SchedulerException {
validateState();
return resources.getJobStore().retrieveCalendar(ctxt, calName);
}
|
public String[] getCalendarNames(SchedulingContext ctxt) throws SchedulerException {
validateState();
return resources.getJobStore().getCalendarNames(ctxt);
}
|
public List getCurrentlyExecutingJobs() {
return jobMgr.getExecutingJobs();
}
Return a list of JobExecutionContext objects that
represent all currently executing Jobs in this Scheduler instance.
This method is not cluster aware. That is, it will only return Jobs
currently executing in this Scheduler instance, not across the entire
cluster.
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.
|
public JobListener getGlobalJobListener(String name) {
synchronized (globalJobListeners) {
return (JobListener)globalJobListeners.get(name);
}
}
|
public List getGlobalJobListeners() {
synchronized (globalJobListeners) {
return new LinkedList(globalJobListeners.values());
}
}
|
public TriggerListener getGlobalTriggerListener(String name) {
synchronized (globalTriggerListeners) {
return (TriggerListener)globalTriggerListeners.get(name);
}
}
|
public List getGlobalTriggerListeners() {
synchronized (globalTriggerListeners) {
return new LinkedList(globalTriggerListeners.values());
}
}
|
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);
}
|
public JobFactory getJobFactory() {
return jobFactory;
}
|
public String[] getJobGroupNames(SchedulingContext ctxt) throws SchedulerException {
validateState();
return resources.getJobStore().getJobGroupNames(ctxt);
}
|
public JobListener getJobListener(String name) {
synchronized (jobListeners) {
return (JobListener) jobListeners.get(name);
}
}
|
public Set getJobListenerNames() {
synchronized (jobListeners) {
return new HashSet(jobListeners.keySet());
}
}
|
public String[] getJobNames(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getJobNames(ctxt, groupName);
}
|
public Class getJobStoreClass() {
return resources.getJobStore().getClass();
}
|
public Log getLog() {
return log;
}
|
public Set getPausedTriggerGroups(SchedulingContext ctxt) throws SchedulerException {
return resources.getJobStore().getPausedTriggerGroups(ctxt);
}
|
public SchedulerContext getSchedulerContext() throws SchedulerException {
return context;
}
|
public String getSchedulerInstanceId() {
return resources.getInstanceId();
}
|
public List getSchedulerListeners() {
synchronized (schedulerListeners) {
return (List)schedulerListeners.clone();
}
}
|
public String getSchedulerName() {
return resources.getName();
}
|
public SchedulerSignaler getSchedulerSignaler() {
return signaler;
}
|
public ThreadGroup getSchedulerThreadGroup() {
if (threadGroup == null) {
threadGroup = new ThreadGroup("QuartzScheduler:"
+ getSchedulerName());
if (resources.getMakeSchedulerThreadDaemon()) {
threadGroup.setDaemon(true);
}
}
return threadGroup;
}
|
public Class getThreadPoolClass() {
return resources.getThreadPool().getClass();
}
|
public int getThreadPoolSize() {
return resources.getThreadPool().getPoolSize();
}
|
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);
}
|
public String[] getTriggerGroupNames(SchedulingContext ctxt) throws SchedulerException {
validateState();
return resources.getJobStore().getTriggerGroupNames(ctxt);
}
|
public TriggerListener getTriggerListener(String name) {
synchronized (triggerListeners) {
return (TriggerListener) triggerListeners.get(name);
}
}
|
public Set getTriggerListenerNames() {
synchronized (triggerListeners) {
return new HashSet(triggerListeners.keySet());
}
}
|
public String[] getTriggerNames(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
return resources.getJobStore().getTriggerNames(ctxt, groupName);
}
|
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);
}
|
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);
}
|
public String getVersion() {
return getVersionMajor() + "." + getVersionMinor() + "."
+ getVersionIteration();
}
|
public static String getVersionIteration() {
return VERSION_ITERATION;
}
|
public static String getVersionMajor() {
return VERSION_MAJOR;
}
|
public static String getVersionMinor() {
return VERSION_MINOR;
}
|
public boolean interrupt(SchedulingContext ctxt,
String jobName,
String groupName) throws UnableToInterruptJobException {
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
List jobs = getCurrentlyExecutingJobs();
java.util.Iterator it = jobs.iterator();
JobExecutionContext jec = null;
JobDetail jobDetail = null;
Job job = null;
boolean interrupted = false;
while (it.hasNext()) {
jec = (JobExecutionContext)it.next();
jobDetail = jec.getJobDetail();
if (jobName.equals(jobDetail.getName())
&& groupName.equals(jobDetail.getGroup())){
job = jec.getJobInstance();
if (job instanceof InterruptableJob) {
((InterruptableJob)job).interrupt();
interrupted = true;
} else {
throw new UnableToInterruptJobException(
"Job '"
+ jobName
+ "' of group '"
+ groupName
+ "' can not be interrupted, since it does not implement "
+ InterruptableJob.class.getName());
}
}
}
return interrupted;
}
Interrupt all instances of the identified InterruptableJob executing in
this Scheduler instance.
This method is not cluster aware. That is, it will only interrupt
instances of the identified InterruptableJob currently executing in this
Scheduler instance, not across the entire cluster.
|
public boolean isInStandbyMode() {
return schedThread.isPaused();
}
|
public boolean isShutdown() {
return closed;
}
|
public boolean isSignalOnSchedulingChange() {
return signalOnSchedulingChange;
}
|
public void notifyJobListenersToBeExecuted(JobExecutionContext jec) throws SchedulerException {
// build a list of all job listeners that are to be notified...
List jobListeners = buildJobListenerList(jec.getJobDetail()
.getJobListenerNames());
// notify all job listeners
java.util.Iterator itr = jobListeners.iterator();
while (itr.hasNext()) {
JobListener jl = (JobListener) itr.next();
try {
jl.jobToBeExecuted(jec);
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"JobListener '" + jl.getName() + "' threw exception: "
+ e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_JOB_LISTENER);
throw se;
}
}
}
|
public void notifyJobListenersWasExecuted(JobExecutionContext jec,
JobExecutionException je) throws SchedulerException {
// build a list of all job listeners that are to be notified...
List jobListeners = buildJobListenerList(jec.getJobDetail()
.getJobListenerNames());
// notify all job listeners
java.util.Iterator itr = jobListeners.iterator();
while (itr.hasNext()) {
JobListener jl = (JobListener) itr.next();
try {
jl.jobWasExecuted(jec, je);
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"JobListener '" + jl.getName() + "' threw exception: "
+ e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_JOB_LISTENER);
throw se;
}
}
}
|
public void notifyJobListenersWasVetoed(JobExecutionContext jec) throws SchedulerException {
// build a list of all job listeners that are to be notified...
List jobListeners = buildJobListenerList(jec.getJobDetail()
.getJobListenerNames());
// notify all job listeners
java.util.Iterator itr = jobListeners.iterator();
while (itr.hasNext()) {
JobListener jl = (JobListener) itr.next();
try {
jl.jobExecutionVetoed(jec);
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"JobListener '" + jl.getName() + "' threw exception: "
+ e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_JOB_LISTENER);
throw se;
}
}
}
|
protected void notifyJobStoreJobComplete(SchedulingContext ctxt,
Trigger trigger,
JobDetail detail,
int instCode) throws JobPersistenceException {
resources.getJobStore().triggeredJobComplete(ctxt, trigger, detail,
instCode);
}
|
protected void notifyJobStoreJobVetoed(SchedulingContext ctxt,
Trigger trigger,
JobDetail detail,
int instCode) throws JobPersistenceException {
resources.getJobStore().triggeredJobComplete(ctxt, trigger, detail, instCode);
}
|
public void notifySchedulerListenersError(String msg,
SchedulerException se) {
// build a list of all scheduler listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.schedulerError(msg, se);
} catch (Exception e) {
getLog()
.error(
"Error while notifying SchedulerListener of error: ",
e);
getLog().error(
" Original error (for notification) was: " + msg, se);
}
}
}
|
public void notifySchedulerListenersFinalized(Trigger trigger) {
// build a list of all scheduler listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.triggerFinalized(trigger);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of finalized trigger."
+ " Triger=" + trigger.getFullName(), e);
}
}
}
|
public void notifySchedulerListenersPausedJob(String name,
String group) {
// build a list of all job listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.jobsPaused(name, group);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of paused job/group."
+ " Job=" + group + "." + name, e);
}
}
}
|
public void notifySchedulerListenersPausedTrigger(String name,
String group) {
// build a list of all job listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.triggersPaused(name, group);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of paused trigger/group."
+ " Triger=" + group + "." + name, e);
}
}
}
|
public void notifySchedulerListenersResumedJob(String name,
String group) {
// build a list of all job listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.jobsResumed(name, group);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of resumed job/group."
+ " Job=" + group + "." + name, e);
}
}
}
|
public void notifySchedulerListenersResumedTrigger(String name,
String group) {
// build a list of all job listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.triggersResumed(name, group);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of resumed trigger/group."
+ " Triger=" + group + "." + name, e);
}
}
}
|
public void notifySchedulerListenersSchduled(Trigger trigger) {
// build a list of all scheduler listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.jobScheduled(trigger);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of scheduled job."
+ " Triger=" + trigger.getFullName(), e);
}
}
}
|
public void notifySchedulerListenersShutdown() {
// build a list of all job listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.schedulerShutdown();
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of shutdown.",
e);
}
}
}
|
public void notifySchedulerListenersUnschduled(String triggerName,
String triggerGroup) {
// build a list of all scheduler listeners that are to be notified...
List schedListeners = getSchedulerListeners();
// notify all scheduler listeners
java.util.Iterator itr = schedListeners.iterator();
while (itr.hasNext()) {
SchedulerListener sl = (SchedulerListener) itr.next();
try {
sl.jobUnscheduled(triggerName, triggerGroup);
} catch (Exception e) {
getLog().error(
"Error while notifying SchedulerListener of unscheduled job."
+ " Triger=" + triggerGroup + "."
+ triggerName, e);
}
}
}
|
protected void notifySchedulerThread() {
if (isSignalOnSchedulingChange()) {
schedThread.signalSchedulingChange();
}
}
|
public void notifyTriggerListenersComplete(JobExecutionContext jec,
int instCode) throws SchedulerException {
// build a list of all trigger listeners that are to be notified...
List triggerListeners = buildTriggerListenerList(jec.getTrigger()
.getTriggerListenerNames());
// notify all trigger listeners in the list
java.util.Iterator itr = triggerListeners.iterator();
while (itr.hasNext()) {
TriggerListener tl = (TriggerListener) itr.next();
try {
tl.triggerComplete(jec.getTrigger(), jec, instCode);
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"TriggerListener '" + tl.getName()
+ "' threw exception: " + e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_TRIGGER_LISTENER);
throw se;
}
}
}
|
public boolean notifyTriggerListenersFired(JobExecutionContext jec) throws SchedulerException {
// build a list of all trigger listeners that are to be notified...
List triggerListeners = buildTriggerListenerList(jec.getTrigger()
.getTriggerListenerNames());
boolean vetoedExecution = false;
// notify all trigger listeners in the list
java.util.Iterator itr = triggerListeners.iterator();
while (itr.hasNext()) {
TriggerListener tl = (TriggerListener) itr.next();
try {
tl.triggerFired(jec.getTrigger(), jec);
if(tl.vetoJobExecution(jec.getTrigger(), jec)) {
vetoedExecution = true;
}
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"TriggerListener '" + tl.getName()
+ "' threw exception: " + e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_TRIGGER_LISTENER);
throw se;
}
}
return vetoedExecution;
}
|
public void notifyTriggerListenersMisfired(Trigger trigger) throws SchedulerException {
// build a list of all trigger listeners that are to be notified...
List triggerListeners = buildTriggerListenerList(trigger
.getTriggerListenerNames());
// notify all trigger listeners in the list
java.util.Iterator itr = triggerListeners.iterator();
while (itr.hasNext()) {
TriggerListener tl = (TriggerListener) itr.next();
try {
tl.triggerMisfired(trigger);
} catch (Exception e) {
SchedulerException se = new SchedulerException(
"TriggerListener '" + tl.getName()
+ "' threw exception: " + e.getMessage(), e);
se.setErrorCode(SchedulerException.ERR_TRIGGER_LISTENER);
throw se;
}
}
}
|
public int numJobsExecuted() {
return jobMgr.getNumJobsFired();
}
|
public void pauseAll(SchedulingContext ctxt) throws SchedulerException {
validateState();
resources.getJobStore().pauseAll(ctxt);
notifySchedulerThread();
notifySchedulerListenersPausedTrigger(null, null);
}
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group.
When resumeAll() is called (to un-pause), trigger misfire
instructions WILL be applied.
|
public void pauseJob(SchedulingContext ctxt,
String jobName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().pauseJob(ctxt, jobName, groupName);
notifySchedulerThread();
notifySchedulerListenersPausedJob(jobName, groupName);
}
|
public void pauseJobGroup(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().pauseJobGroup(ctxt, groupName);
notifySchedulerThread();
notifySchedulerListenersPausedJob(null, groupName);
}
|
public void pauseTrigger(SchedulingContext ctxt,
String triggerName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().pauseTrigger(ctxt, triggerName, groupName);
notifySchedulerThread();
notifySchedulerListenersPausedTrigger(triggerName, groupName);
}
|
public void pauseTriggerGroup(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().pauseTriggerGroup(ctxt, groupName);
notifySchedulerThread();
notifySchedulerListenersPausedTrigger(null, groupName);
}
|
public boolean removeGlobalJobListener(JobListener jobListener) {
return removeGlobalJobListener((jobListener == null) ? null : jobListener.getName());
} Deprecated! Use - #removeGlobalJobListener(String)
|
public boolean removeGlobalJobListener(String name) {
synchronized (globalJobListeners) {
return (globalJobListeners.remove(name) != null);
}
}
|
public boolean removeGlobalTriggerListener(TriggerListener triggerListener) {
return removeGlobalTriggerListener((triggerListener == null) ? null : triggerListener.getName());
} Deprecated! Use - #removeGlobalTriggerListener(String)
|
public boolean removeGlobalTriggerListener(String name) {
synchronized (globalTriggerListeners) {
return (globalTriggerListeners.remove(name) != null);
}
}
|
public boolean removeJobListener(String name) {
synchronized (jobListeners) {
return (jobListeners.remove(name) != null);
}
}
|
public boolean removeNoGCObject(Object obj) {
return holdToPreventGC.remove(obj);
}
|
public boolean removeSchedulerListener(SchedulerListener schedulerListener) {
synchronized (schedulerListeners) {
return schedulerListeners.remove(schedulerListener);
}
}
|
public boolean removeTriggerListener(String name) {
synchronized (triggerListeners) {
return (triggerListeners.remove(name) != null);
}
}
|
public Date rescheduleJob(SchedulingContext ctxt,
String triggerName,
String groupName,
Trigger newTrigger) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
newTrigger.validate();
Calendar cal = null;
if (newTrigger.getCalendarName() != null) {
cal = resources.getJobStore().retrieveCalendar(ctxt,
newTrigger.getCalendarName());
}
Date ft = newTrigger.computeFirstFireTime(cal);
if (ft == null) {
throw new SchedulerException(
"Based on configured schedule, the given trigger will never fire.",
SchedulerException.ERR_CLIENT_ERROR);
}
if (resources.getJobStore().replaceTrigger(ctxt, triggerName, groupName, newTrigger)) {
notifySchedulerThread();
notifySchedulerListenersUnschduled(triggerName, groupName);
notifySchedulerListenersSchduled(newTrigger);
} else {
return null;
}
return ft;
}
Remove (delete) the org.quartz.Trigger with the
given name, and store the new given one - which must be associated
with the same job.
|
public void resumeAll(SchedulingContext ctxt) throws SchedulerException {
validateState();
resources.getJobStore().resumeAll(ctxt);
notifySchedulerThread();
notifySchedulerListenersResumedTrigger(null, null);
}
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.
|
public void resumeJob(SchedulingContext ctxt,
String jobName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().resumeJob(ctxt, jobName, groupName);
notifySchedulerThread();
notifySchedulerListenersResumedJob(jobName, groupName);
}
Resume (un-pause) the org.quartz.JobDetail with
the given name.
If any of the Job'sTrigger s missed one
or more fire-times, then the Trigger's misfire
instruction will be applied.
|
public void resumeJobGroup(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().resumeJobGroup(ctxt, groupName);
notifySchedulerThread();
notifySchedulerListenersResumedJob(null, groupName);
}
Resume (un-pause) all of the org.quartz.JobDetail s
in the given group.
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.
|
public void resumeTrigger(SchedulingContext ctxt,
String triggerName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().resumeTrigger(ctxt, triggerName, groupName);
notifySchedulerThread();
notifySchedulerListenersResumedTrigger(triggerName, groupName);
}
Resume (un-pause) the Trigger with the given
name.
If the Trigger missed one or more fire-times, then the
Trigger's misfire instruction will be applied.
|
public void resumeTriggerGroup(SchedulingContext ctxt,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
resources.getJobStore().resumeTriggerGroup(ctxt, groupName);
notifySchedulerThread();
notifySchedulerListenersResumedTrigger(null, groupName);
}
Resume (un-pause) all of the Trigger s in the
given group.
If any Trigger missed one or more fire-times, then the
Trigger's misfire instruction will be applied.
|
public Date runningSince() {
return initialStart;
}
|
public Date scheduleJob(SchedulingContext ctxt,
Trigger trigger) throws SchedulerException {
validateState();
if (trigger == null) {
throw new SchedulerException("Trigger cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
trigger.validate();
Calendar cal = null;
if (trigger.getCalendarName() != null) {
cal = resources.getJobStore().retrieveCalendar(ctxt,
trigger.getCalendarName());
if(cal == null) {
throw new SchedulerException(
"Calendar not found: " + trigger.getCalendarName(),
SchedulerException.ERR_PERSISTENCE_CALENDAR_DOES_NOT_EXIST);
}
}
Date ft = trigger.computeFirstFireTime(cal);
if (ft == null) {
throw new SchedulerException(
"Based on configured schedule, the given trigger will never fire.",
SchedulerException.ERR_CLIENT_ERROR);
}
resources.getJobStore().storeTrigger(ctxt, trigger, false);
notifySchedulerThread();
notifySchedulerListenersSchduled(trigger);
return ft;
}
|
public Date scheduleJob(SchedulingContext ctxt,
JobDetail jobDetail,
Trigger trigger) throws SchedulerException {
validateState();
if (jobDetail == null) {
throw new SchedulerException("JobDetail cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
if (trigger == null) {
throw new SchedulerException("Trigger cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
jobDetail.validate();
if (trigger.getJobName() == null) {
trigger.setJobName(jobDetail.getName());
trigger.setJobGroup(jobDetail.getGroup());
} else if (trigger.getJobName() != null
&& !trigger.getJobName().equals(jobDetail.getName())) {
throw new SchedulerException(
"Trigger does not reference given job!",
SchedulerException.ERR_CLIENT_ERROR);
} else if (trigger.getJobGroup() != null
&& !trigger.getJobGroup().equals(jobDetail.getGroup())) {
throw new SchedulerException(
"Trigger does not reference given job!",
SchedulerException.ERR_CLIENT_ERROR);
}
trigger.validate();
Calendar cal = null;
if (trigger.getCalendarName() != null) {
cal = resources.getJobStore().retrieveCalendar(ctxt,
trigger.getCalendarName());
}
Date ft = trigger.computeFirstFireTime(cal);
if (ft == null) {
throw new SchedulerException(
"Based on configured schedule, the given trigger will never fire.",
SchedulerException.ERR_CLIENT_ERROR);
}
resources.getJobStore().storeJobAndTrigger(ctxt, jobDetail, trigger);
notifySchedulerThread();
notifySchedulerListenersSchduled(trigger);
return ft;
}
Add the org.quartz.Job identified by the given
org.quartz.JobDetail to the Scheduler, and
associate the given org.quartz.Trigger with it.
If the given Trigger does not reference any Job, then it
will be set to reference the Job passed with it into this method.
|
public void setJobFactory(JobFactory factory) throws SchedulerException {
if(factory == null) {
throw new IllegalArgumentException("JobFactory cannot be set to null!");
}
getLog().info("JobFactory set to: " + factory);
this.jobFactory = factory;
}
|
public void setSignalOnSchedulingChange(boolean signalOnSchedulingChange) {
this.signalOnSchedulingChange = signalOnSchedulingChange;
}
|
public void shutdown() {
shutdown(false);
}
Halts the QuartzScheduler's firing of org.quartz.Trigger s,
and cleans up all resources associated with the QuartzScheduler.
Equivalent to shutdown(false).
The scheduler cannot be re-started.
|
public void shutdown(boolean waitForJobsToComplete) {
if(closed == true) {
return;
}
getLog().info(
"Scheduler " + resources.getUniqueIdentifier()
+ " shutting down.");
standby();
closed = true;
schedThread.halt();
resources.getThreadPool().shutdown(waitForJobsToComplete);
if (waitForJobsToComplete) {
while (jobMgr.getNumJobsCurrentlyExecuting() > 0) {
try {
Thread.sleep(100);
} catch (Exception ignore) {
}
}
}
// Scheduler thread may have be waiting for the fire time of an acquired
// trigger and need time to release the trigger once halted, so make sure
// the thread is dead before continuing to shutdown the job store.
try {
schedThread.join();
} catch (InterruptedException ignore) {
}
resources.getJobStore().shutdown();
notifySchedulerListenersShutdown();
shutdownPlugins();
SchedulerRepository.getInstance().remove(resources.getName());
holdToPreventGC.clear();
try {
unBind();
} catch (RemoteException re) {
}
if (resources.getJMXExport()) {
try {
unregisterJMX();
} catch (Exception e) {
}
}
getLog().info(
"Scheduler " + resources.getUniqueIdentifier()
+ " shutdown complete.");
}
Halts the QuartzScheduler's firing of org.quartz.Trigger s,
and cleans up all resources associated with the QuartzScheduler.
The scheduler cannot be re-started.
|
public void standby() {
schedThread.togglePause(true);
getLog().info(
"Scheduler " + resources.getUniqueIdentifier() + " paused.");
}
Temporarily halts the QuartzScheduler's firing of org.quartz.Trigger s.
The scheduler is not destroyed, and can be re-started at any time.
|
public void start() throws SchedulerException {
if (closed) {
throw new SchedulerException(
"The Scheduler cannot be restarted after shutdown() has been called.");
}
if (initialStart == null) {
initialStart = new Date();
this.resources.getJobStore().schedulerStarted();
startPlugins();
}
schedThread.togglePause(false);
getLog().info(
"Scheduler " + resources.getUniqueIdentifier() + " started.");
}
|
public boolean supportsPersistence() {
return resources.getJobStore().supportsPersistence();
}
|
public void triggerJob(SchedulingContext ctxt,
String jobName,
String groupName,
JobDataMap data) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
Trigger trig = new org.quartz.SimpleTrigger(newTriggerId(),
Scheduler.DEFAULT_MANUAL_TRIGGERS, jobName, groupName,
new Date(), null, 0, 0);
trig.setVolatility(false);
trig.computeFirstFireTime(null);
if(data != null) {
trig.setJobDataMap(data);
}
boolean collision = true;
while (collision) {
try {
resources.getJobStore().storeTrigger(ctxt, trig, false);
collision = false;
} catch (ObjectAlreadyExistsException oaee) {
trig.setName(newTriggerId());
}
}
notifySchedulerThread();
notifySchedulerListenersSchduled(trig);
}
|
public void triggerJobWithVolatileTrigger(SchedulingContext ctxt,
String jobName,
String groupName,
JobDataMap data) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
Trigger trig = new org.quartz.SimpleTrigger(newTriggerId(),
Scheduler.DEFAULT_MANUAL_TRIGGERS, jobName, groupName,
new Date(), null, 0, 0);
trig.setVolatility(true);
trig.computeFirstFireTime(null);
if(data != null) {
trig.setJobDataMap(data);
}
boolean collision = true;
while (collision) {
try {
resources.getJobStore().storeTrigger(ctxt, trig, false);
collision = false;
} catch (ObjectAlreadyExistsException oaee) {
trig.setName(newTriggerId());
}
}
notifySchedulerThread();
notifySchedulerListenersSchduled(trig);
}
|
public boolean unscheduleJob(SchedulingContext ctxt,
String triggerName,
String groupName) throws SchedulerException {
validateState();
if(groupName == null) {
groupName = Scheduler.DEFAULT_GROUP;
}
if (resources.getJobStore().removeTrigger(ctxt, triggerName, groupName)) {
notifySchedulerThread();
notifySchedulerListenersUnschduled(triggerName, groupName);
} else {
return false;
}
return true;
}
|
public void validateState() throws SchedulerException {
if (isShutdown()) {
throw new SchedulerException("The Scheduler has been shutdown.");
}
// other conditions to check (?)
}
|