posted 17 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
hi
we are using quartz in our application for scheduling process,Every thing works fine but ,in our clustered production server ,some of the jobs are not getting executed due to ERROR status in TRIGGER_STATE column in QUARTZ_TRIGGER table.Acutally when i posted in some forum they said that this usually happens if the class file is not Found ie(ClassNotFoundException)will be thrown ,but i have chekced the logs of our clustered server ,there is no such kind of error.
I will give the environmental details as well
we are using quartz 1.4.1 version.
with Quartz.properties
as given below
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = DefaultSystemScheduler
org.quartz.scheduler.instanceId = Default
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 2
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = com.olt.waf.db.WeblogicOracleDelegate
org.quartz.jobStore.dataSource = ds
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = false
#============================================================================
# Configure Datasources
#============================================================================
# org.quartz.dataSource.ds.jndiURL = comp/env/jdbc/rfx
# org.quartz.dataSource.ds.driver = oracle.jdbc.OracleDriver
## The URL is supplied by the init servlet that boots the scheduler
## via the system properties. It includes both the username and password,
## and read from the local.conf main url
# org.quartz.dataSource.default.URL = jdbc racle:thin:@arsenic:1521:quartz
# org.quartz.dataSource.ds.user = rfx
# org.quartz.dataSource.ds.password = rfx
# org.quartz.dataSource.ds.maxConnections = 5
Can any plz help me regarding this .waiting for reply
Prasad.S
org.quartz
abstract public class: Trigger [javadoc |
source]
java.lang.Object org.quartz.Trigger
All Implemented Interfaces:
Cloneable, Serializable, Comparable
Direct Known Subclasses:
SimpleTrigger, UICronTrigger, NthIncludedDayTrigger, CronTrigger
The base abstract class to be extended by all Trigger
s.
Triggers
s have a name and group associated with them, which
should uniquely identify them within a single Scheduler
.
Trigger
s are the ‘mechanism’ by which Job
s
are scheduled. Many Trigger
s can point to the same Job
,
but a single Trigger
can only point to one Job
.
Triggers can ‘send’ parameters/data to Job
s by placing contents
into the JobDataMap
on the Trigger
.
- Also see:
- SimpleTrigger
- CronTrigger
- NthIncludedDayTrigger
- TriggerUtils
- JobDataMap
- JobExecutionContext
- author:
James
— House - author:
Sharada
— Jambula
Field Summary | ||
---|---|---|
public static final int | INSTRUCTION_NOOP |
Instructs the
|
public static final int | INSTRUCTION_RE_EXECUTE_JOB |
Instructs the
|
public static final int | INSTRUCTION_SET_TRIGGER_COMPLETE |
Instructs the
|
public static final int | INSTRUCTION_DELETE_TRIGGER |
Instructs the
|
public static final int | INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE |
Instructs the
|
public static final int | INSTRUCTION_SET_TRIGGER_ERROR |
Instructs the
|
public static final int | INSTRUCTION_SET_ALL_JOB_TRIGGERS_ERROR |
Instructs the
|
public static final int | MISFIRE_INSTRUCTION_SMART_POLICY |
Instructs the
In order to see if this instruction fits your needs, you should look at
|
public static final int | STATE_NORMAL |
Indicates that the
|
public static final int | STATE_PAUSED |
Indicates that the
|
public static final int | STATE_COMPLETE |
Indicates that the
«Complete» indicates that the trigger has not remaining fire-times in
|
public static final int | STATE_ERROR |
Indicates that the
A
When the trigger is in the error state, the scheduler will make no
|
public static final int | STATE_BLOCKED |
Indicates that the
A
|
public static final int | STATE_NONE |
Indicates that the
|
public static final int | DEFAULT_PRIORITY | The default value for priority. |
Constructor: |
---|
public Trigger(){ /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Constructors. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ // do nothing... }
Create a
Note that the #setName(String) ,#setGroup(String) and |
public Trigger(String name, String group){ setName(name); setGroup(group); }
Create a
Note that the #setJobName(String) and
Throws: |
public Trigger(String name, String group, String jobName, String jobGroup){ setName(name); setGroup(group); setJobName(jobName); setJobGroup(jobGroup); }
Create a
Throws: |
Method from org.quartz.Trigger Summary: |
---|
addTriggerListener, clearAllTriggerListeners, clone, compareTo, computeFirstFireTime, equals, executionComplete, getCalendarName, getDescription, getEndTime, getFinalFireTime, getFireInstanceId, getFireTimeAfter, getFullJobName, getFullName, getGroup, getJobDataMap, getJobGroup, getJobName, getKey, getMisfireInstruction, getName, getNextFireTime, getPreviousFireTime, getPriority, getStartTime, getTriggerListenerNames, hashCode, isVolatile, mayFireAgain, removeTriggerListener, setCalendarName, setDescription, setEndTime, setFireInstanceId, setGroup, setJobDataMap, setJobGroup, setJobName, setMisfireInstruction, setName, setPriority, setStartTime, setVolatility, toString, triggered, updateAfterMisfire, updateWithNewCalendar, validate, validateMisfireInstruction |
Methods from java.lang.Object: |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.quartz.Trigger Detail: |
---|
public void addTriggerListener(String name){ if (triggerListeners.contains(name)) { throw new IllegalArgumentException( "Trigger listener '" + name + "' is already registered for trigger: " + getFullName()); } triggerListeners.add(name); }
Add the specified name of a |
public void clearAllTriggerListeners(){ triggerListeners.clear(); }
TriggerListener s from the Trigger . |
public Object clone(){ Trigger copy; try { copy = (Trigger) super.clone(); copy.triggerListeners = (LinkedList)triggerListeners.clone(); // Shallow copy the jobDataMap. Note that this means that if a user // modifies a value object in this map from the cloned Trigger // they will also be modifying this Trigger. if (jobDataMap != null) { copy.jobDataMap = (JobDataMap)jobDataMap.clone(); } } catch (CloneNotSupportedException ex) { throw new IncompatibleClassChangeError("Not Cloneable."); } return copy; } |
public int compareTo(Object obj){ Trigger other = (Trigger) obj; Date myTime = getNextFireTime(); Date otherTime = other.getNextFireTime(); if (myTime == null && otherTime == null) { return 0; } if (myTime == null) { return 1; } if (otherTime == null) { return -1; } if(myTime.before(otherTime)) { return -1; } if(myTime.after(otherTime)) { return 1; } return 0; }
Compare the next fire time of this |
abstract public Date computeFirstFireTime(Calendar calendar) This method should not be used by the Quartz client.
Called by the scheduler at the time a
After this method has been called, |
public boolean equals(Object obj){ if (!(obj instanceof Trigger)) { return false; } Trigger other = (Trigger) obj; if (!other.getName().equals(getName())) { return false; } if (!other.getGroup().equals(getGroup())) { return false; } return true; } |
abstract public int executionComplete(JobExecutionContext context, JobExecutionException result) This method should not be used by the Quartz client.
Called after the |
public String getCalendarName(){ return calendarName; }
Get the name of the |
public String getDescription(){ return description; }
Return the description given to the |
abstract public Date getEndTime()
Get the time at which the |
abstract public Date getFinalFireTime()
Returns the last time at which the Note that the return time *may* be in the past. |
public String getFireInstanceId(){ return fireInstanceId; } This method should not be used by the Quartz client. |
abstract public Date getFireTimeAfter(Date afterTime)
Returns the next time at which the |
public String getFullJobName(){ return jobGroup + "." + jobName; }
Returns the ‘full name’ of the |
public String getFullName(){ return group + "." + name; }
Returns the ‘full name’ of the |
public String getGroup(){ return group; }
Get the group of this |
public JobDataMap getJobDataMap(){ if (jobDataMap == null) { jobDataMap = new JobDataMap(); } return jobDataMap; }
Get the
Changes made to this map during job execution are not re-persisted, and |
public String getJobGroup(){ return jobGroup; }
Get the name of the associated |
public String getJobName(){ return jobName; }
Get the name of the associated |
public Key getKey(){ if(key == null) { key = new Key(getName(), getGroup()); } return key; } |
public int getMisfireInstruction(){ return misfireInstruction; }
Get the instruction the
If not explicitly set, the default value is |
public String getName(){ return name; }
Get the name of this |
abstract public Date getNextFireTime()
Returns the next time at which the |
abstract public Date getPreviousFireTime()
Returns the previous time at which the |
public int getPriority(){ return priority; }
Trigger acts as a tiebreaker such that iftwo Trigger s have the same scheduled fire time, then theone with the higher priority will get first access to a worker thread.
If not explicitly set, the default value is |
abstract public Date getStartTime()
Get the time at which the |
public String[] getTriggerListenerNames(){ return (String[])triggerListeners.toArray(new String[triggerListeners.size()]); }
Returns an array of |
public int hashCode(){ return getFullName().hashCode(); } |
public boolean isVolatile(){ return volatility; }
Whether or not the
If not explicitly set, the default value is |
abstract public boolean mayFireAgain()
Used by the
If the returned value is |
public boolean removeTriggerListener(String name){ return triggerListeners.remove(name); }
Remove the specified name of a |
public void setCalendarName(String calendarName){ this.calendarName = calendarName; }
Associate the |
public void setDescription(String description){ this.description = description; }
Set a description for the |
abstract public void setEndTime(Date endTime) |
public void setFireInstanceId(String id){ this.fireInstanceId = id; } This method should not be used by the Quartz client.
Usable by |
public void setGroup(String group){ if (group != null && group.trim().length() == 0) { throw new IllegalArgumentException( "Group name cannot be an empty string."); } if(group == null) { group = Scheduler.DEFAULT_GROUP; } this.group = group; }
Set the name of this |
public void setJobDataMap(JobDataMap jobDataMap){ this.jobDataMap = jobDataMap; }
Set the |
public void setJobGroup(String jobGroup){ if (jobGroup != null && jobGroup.trim().length() == 0) { throw new IllegalArgumentException( "Group name cannot be null or empty."); } if(jobGroup == null) { jobGroup = Scheduler.DEFAULT_GROUP; } this.jobGroup = jobGroup; }
Set the name of the associated |
public void setJobName(String jobName){ if (jobName == null || jobName.trim().length() == 0) { throw new IllegalArgumentException( "Job name cannot be null or empty."); } this.jobName = jobName; }
Set the name of the associated |
public void setMisfireInstruction(int misfireInstruction){ if (!validateMisfireInstruction(misfireInstruction)) { throw new IllegalArgumentException( "The misfire instruction code is invalid for this type of trigger."); } this.misfireInstruction = misfireInstruction; }
Set the instruction the
If not explicitly set, the default value is |
public void setName(String name){ if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException( "Trigger name cannot be null or empty."); } this.name = name; }
Set the name of this |
public void setPriority(int priority){ this.priority = priority; }
Trigger acts as a tiebreaker such that iftwo Trigger s have the same scheduled fire time, then theone with the higher priority will get first access to a worker thread.
If not explicitly set, the default value is |
abstract public void setStartTime(Date startTime) |
public void setVolatility(boolean volatility){ this.volatility = volatility; }
Set whether or not the |
public String toString(){ return "Trigger '" + getFullName() + "': triggerClass: '" + getClass().getName() + " isVolatile: " + isVolatile() + " calendar: '" + getCalendarName() + "' misfireInstruction: " + getMisfireInstruction() + " nextFireTime: " + getNextFireTime(); } Return a simple string representation of this object. |
abstract public void triggered(Calendar calendar) This method should not be used by the Quartz client.
Called when the |
abstract public void updateAfterMisfire(Calendar cal) This method should not be used by the Quartz client. To be implemented by the concrete classes that extend this class.
The implementation should update the |
abstract public void updateWithNewCalendar(Calendar cal, long misfireThreshold) This method should not be used by the Quartz client. To be implemented by the concrete class.
The implementation should update the |
public void validate() throws SchedulerException{ if (name == null) { throw new SchedulerException("Trigger's name cannot be null", SchedulerException.ERR_CLIENT_ERROR); } if (group == null) { throw new SchedulerException("Trigger's group cannot be null", SchedulerException.ERR_CLIENT_ERROR); } if (jobName == null) { throw new SchedulerException( "Trigger's related Job's name cannot be null", SchedulerException.ERR_CLIENT_ERROR); } if (jobGroup == null) { throw new SchedulerException( "Trigger's related Job's group cannot be null", SchedulerException.ERR_CLIENT_ERROR); } }
Validates whether the properties of the |
abstract protected boolean validateMisfireInstruction(int misfireInstruction) |
Jefferson Carpenter
unread,
Dec 19, 2013, 4:02:56 AM12/19/13
to quar…@googlegroups.com
I’ve got some Quartz CRQN triggers that fire normally for several hours or days, and then at random stop firing and go into the ERROR state.
Having set the Common.Logging log level to All, I can see logs about Quartz firing triggers and handling misfires, but there are no logs that explain why my triggers go into the ERROR state.
I can get my jobs to start running again by changing the text of the TRIGGER_STATE column back from ERROR to WAITING. However, I would much rather understand and fix the actual problem than just apply a band-aid like this.
According to google, people have had similar problems in the past.
This problem can be caused when your running instance cannot find the job class to instantiate. According to a blog post, I should expect a message in the Quartz logs when this happens. There’s no such message in the logs, so I doubt this is my problem.
This problem can happen when you get out-of-memory errors while Quartz is busy firing a trigger. I have verified that my memory usage is quite reasonable.
People have mentioned that it’s bad when jobs throw unhandled exceptions. I’m not 100% sure that my jobs don’t throw unhandled exceptions, but the code I’m calling in my jobs is well-used and pretty robust. And anyway, having read some Quartz documentation and run some tests on my machine, it looks like exception-throwing jobs do not cause their triggers to go into the ERROR state.
Any ideas why Quartz might not be logging the problem that’s putting the triggers into the ERROR state?
Or what else could cause a trigger to go into the ERROR state?
Marko Lahma
unread,
Dec 22, 2013, 2:14:21 PM12/22/13
to quar…@googlegroups.com
Are you doing some logic in job’s constructor? I’ve seen people
instantiating db contexts and whatnot and that causing exceptions
which lead to marking job’s all triggers to error state.
General rule (for object-oriented programming), do not throw
exceptions from constructors.
-Marko
On 12/19/13, Jefferson Carpenter <jefferson…@gmail.com> wrote:
> I’ve got some Quartz CRQN triggers that fire normally for several hours or
> days, and then at random stop firing and go into the ERROR state.
>
> Having set the Common.Logging log level to All, I can see logs about Quartz
>
> firing triggers and handling misfires, but there are no logs that explain
> why my triggers go into the ERROR state.
>
> I can get my jobs to start running again by changing the text of the
> TRIGGER_STATE column back from ERROR to WAITING. However, I would much
> rather understand and fix the actual problem than just apply a band-aid
> like this.
>
>
> According to google, people have had
> similar<https://forums.terracotta.org/forums/posts/list/2881.page>
> problems<http://stackoverflow.com/questions/618265/quartz-scheduler-suddenly-stop-running-and-no-exception-error>in
> the past.
>
> This problem can be caused when your running instance cannot find the job
> class to instantiate. According to a blog
> post<http://mail2vks.blogspot.com/2012/05/quartz-scheduler-trigger-in-error-state.html>,
>
> I should expect a message in the Quartz logs when this happens. There’s no
>
> such message in the logs, so I doubt this is my problem.
>
> This problem can happen when you get out-of-memory errors while Quartz is
> busy firing a trigger. I have verified that my memory usage is quite
> reasonable.
>
> People have mentioned that it’s bad when jobs throw unhandled exceptions.
> I’m not 100% sure that my jobs don’t throw unhandled exceptions, but the
> code I’m calling in my jobs is well-used and pretty robust. And anyway,
> having read some Quartz
> documentation<http://quartz-scheduler.org/documentation/best-practices#jobs>and
> run some tests on my machine, it looks like exception-throwing jobs do
> not cause their triggers to go into the ERROR state.
>
>
> Any ideas why Quartz might not be logging the problem that’s putting the
> triggers into the ERROR state?
>
> Or what else could cause a trigger to go into the ERROR state?
>
> —
> You received this message because you are subscribed to the Google Groups
> «Quartz.NET» group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to quartznet+…@googlegroups.com.
> To post to this group, send email to quar…@googlegroups.com.
> Visit this group at http://groups.google.com/group/quartznet.
> For more options, visit https://groups.google.com/groups/opt_out.
>
许涵洋
unread,
Sep 16, 2014, 10:17:05 AM9/16/14
to quar…@googlegroups.com
Hi, Jefferson
Do you solve the issue ? I also find the same problem