Quartz trigger state error

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. Can any plz help me regarding this .waiting for reply.


posted 17 years ago

  • Mark post as helpful


  • send pies

    Number of slices to send:

    Optional ‘thank-you’ note:



  • Quote
  • Report post to moderator

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 Triggers.

Triggers s have a name and group associated with them, which
should uniquely identify them within a single Scheduler .

Triggers 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 Jobs 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 Scheduler that the Trigger
has no further instructions.

 

public static final  int INSTRUCTION_RE_EXECUTE_JOB   

Instructs the Scheduler that the Trigger
wants the org.quartz.JobDetail to re-execute
immediately. If not in a ‘RECOVERING’ or ‘FAILED_OVER’ situation, the
execution context will be re-used (giving the Job the
abilitiy to ‘see’ anything placed in the context by its last execution).

 

public static final  int INSTRUCTION_SET_TRIGGER_COMPLETE   

Instructs the Scheduler that the Trigger
should be put in the COMPLETE state.

 

public static final  int INSTRUCTION_DELETE_TRIGGER   

Instructs the Scheduler that the Trigger
wants itself deleted.

 

public static final  int INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE   

Instructs the Scheduler that all Trigger
s referencing the same org.quartz.JobDetail as
this one should be put in the COMPLETE state.

 

public static final  int INSTRUCTION_SET_TRIGGER_ERROR   

Instructs the Scheduler that all Trigger
s referencing the same org.quartz.JobDetail as
this one should be put in the ERROR state.

 

public static final  int INSTRUCTION_SET_ALL_JOB_TRIGGERS_ERROR   

Instructs the Scheduler that the Trigger
should be put in the ERROR state.

 

public static final  int MISFIRE_INSTRUCTION_SMART_POLICY   

Instructs the Scheduler that upon a mis-fire
situation, the updateAfterMisfire() method will be called
on the Trigger to determine the mis-fire instruction.

In order to see if this instruction fits your needs, you should look at
the documentation for the getSmartMisfirePolicy() method
on the particular Trigger implementation you are using.

 

public static final  int STATE_NORMAL   

Indicates that the Trigger is in the «normal» state.

 

public static final  int STATE_PAUSED   

Indicates that the Trigger is in the «paused» state.

 

public static final  int STATE_COMPLETE   

Indicates that the Trigger is in the «complete» state.

«Complete» indicates that the trigger has not remaining fire-times in
its schedule.

 

public static final  int STATE_ERROR   

Indicates that the Trigger is in the «error» state.

A Trigger arrives at the error state when the scheduler
attempts to fire it, but cannot due to an error creating and executing
its related job. Often this is due to the Job‘s
class not existing in the classpath.

When the trigger is in the error state, the scheduler will make no
attempts to fire it.

 

public static final  int STATE_BLOCKED   

Indicates that the Trigger is in the «blocked» state.

A Trigger arrives at the blocked state when the job that
it is associated with is a StatefulJob and it is
currently executing.

    Also see:

    StatefulJob

 

public static final  int STATE_NONE   

Indicates that the Trigger does not exist.

 

public static final  int DEFAULT_PRIORITY    The default value for priority. 
Constructor:
 public Trigger() 
{
    /*
    * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    *
    * Constructors.
    *
    * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    */
        // do nothing...
}

    Create a Trigger with no specified name, group, or org.quartz.JobDetail .

    Note that the #setName(String) ,#setGroup(String) and
    the #setJobName(String) and #setJobGroup(String) methods
    must be called before the Trigger can be placed into a
    Scheduler .

 public Trigger(String name,
    String group) 
{
        setName(name);
        setGroup(group);
}

    Create a Trigger with the given name, and group.

    Note that the #setJobName(String) and
    #setJobGroup(String) methods must be called before the Trigger
    can be placed into a Scheduler .

    Parameters:

    group — if null, Scheduler.DEFAULT_GROUP will be used.

    Throws:

    IllegalArgumentException
    if name is null or empty, or the group is an empty string.
    exception: IllegalArgumentException
    if name is null or empty, or the group is an empty string.
 public Trigger(String name,
    String group,
    String jobName,
    String jobGroup) 
{
        setName(name);
        setGroup(group);
        setJobName(jobName);
        setJobGroup(jobGroup);
}

    Create a Trigger with the given name, and group.

    Parameters:

    group — if null, Scheduler.DEFAULT_GROUP will be used.

    Throws:

    IllegalArgumentException
    if name is null or empty, or the group is an empty string.
    exception: IllegalArgumentException
    if name is null or empty, or the group is an empty string.
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 TriggerListener to
    the end of the Trigger‘s list of listeners.

 public  void clearAllTriggerListeners() 
{
        triggerListeners.clear();
}
    Remove all 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 Trigger to that of
    another.

 abstract public Date computeFirstFireTime(Calendar calendar)

    This method should not be used by the Quartz client.

    Called by the scheduler at the time a Trigger is first added to the scheduler, in order to have the Trigger compute its first fire time, based on any associated calendar.

    After this method has been called, getNextFireTime() should return a valid answer.

 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 Scheduler has executed the org.quartz.JobDetail associated with the Trigger in order to get the final instruction code from the trigger.

 public String getCalendarName() 
{
        return calendarName;
}

    Get the name of the Calendar associated with this
    Trigger.

 public String getDescription() 
{
        return description;
}

    Return the description given to the Trigger instance by
    its creator (if any).

 abstract public Date getEndTime()

    Get the time at which the Trigger should quit repeating - even if an assigned 'repeatCount' isn't yet satisfied.

 abstract public Date getFinalFireTime()

    Returns the last time at which the Trigger will fire, if the Trigger will repeat indefinitely, null will be returned.

    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 Trigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

 public String getFullJobName() 
{
        return jobGroup + "." + jobName;
}

    Returns the ‘full name’ of the Job that the Trigger
    points to, in the format «group.name».

 public String getFullName() 
{
        return group + "." + name;
}

    Returns the ‘full name’ of the Trigger in the format
    «group.name».

 public String getGroup() 
{
        return group;
}

    Get the group of this Trigger.

 public JobDataMap getJobDataMap() 
{
        if (jobDataMap == null) {
            jobDataMap = new JobDataMap();
        }
        return jobDataMap;
}

    Get the JobDataMap that is associated with the
    Trigger.

    Changes made to this map during job execution are not re-persisted, and
    in fact typically result in an IllegalStateException.

 public String getJobGroup() 
{
        return jobGroup;
}

    Get the name of the associated org.quartz.JobDetail ‘s
    group.

 public String getJobName() 
{
        return jobName;
}

    Get the name of the associated org.quartz.JobDetail .

 public Key getKey() 
{
        if(key == null) {
            key = new Key(getName(), getGroup());
        }
        return key;
}
 public int getMisfireInstruction() 
{
        return misfireInstruction;
}

    Get the instruction the Scheduler should be given for
    handling misfire situations for this Trigger— the
    concrete Trigger type that you are using will have
    defined a set of additional MISFIRE_INSTRUCTION_XXX
    constants that may be passed to this method.

    If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.

 public String getName() 
{
        return name;
}

    Get the name of this Trigger.

 abstract public Date getNextFireTime()

    Returns the next time at which the Trigger will fire. If the trigger will not fire again, null will be returned. The value returned is not guaranteed to be valid until after the Trigger has been added to the scheduler.

 abstract public Date getPreviousFireTime()

    Returns the previous time at which the Trigger will fire. If the trigger has not yet fired, null will be returned.

 public int getPriority() 
{
        return priority;
}
    The priority of a Trigger acts as a tiebreaker such that if
    two Triggers have the same scheduled fire time, then the
    one with the higher priority will get first access to a worker
    thread.

    If not explicitly set, the default value is 5.

 abstract public Date getStartTime()

    Get the time at which the Trigger should occur.

 public String[] getTriggerListenerNames() 
{
        return (String[])triggerListeners.toArray(new String[triggerListeners.size()]);
}

    Returns an array of String containing the names of all
    TriggerListener s assigned to the Trigger,
    in the order in which they should be notified.

 public int hashCode() 
{
        return getFullName().hashCode();
}
 public boolean isVolatile() 
{
        return volatility;
}

    Whether or not the Trigger should be persisted in the
    org.quartz.spi.JobStore for re-use after program
    restarts.

    If not explicitly set, the default value is false.

 abstract public boolean mayFireAgain()

    Used by the Scheduler to determine whether or not it is possible for this Trigger to fire again.

    If the returned value is false then the Scheduler may remove the Trigger from the org.quartz.spi.JobStore .

 public boolean removeTriggerListener(String name) 
{
        return triggerListeners.remove(name);
}

    Remove the specified name of a TriggerListener
    from the Trigger‘s list of listeners.

 public  void setCalendarName(String calendarName) 
{
        this.calendarName = calendarName;
}

    Associate the Calendar with the given name with
    this Trigger.

 public  void setDescription(String description) 
{
        this.description = description;
}

    Set a description for the Trigger instance — may be
    useful for remembering/displaying the purpose of the trigger, though the
    description has no meaning to Quartz.

 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 org.quartz.spi.JobStore
    implementations, in order to facilitate ‘recognizing’ instances of fired
    Trigger s as their jobs complete execution.

 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 Trigger.

 public  void setJobDataMap(JobDataMap jobDataMap) 
{
        this.jobDataMap = jobDataMap;
}

    Set the JobDataMap to be associated with the
    Trigger.

 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 org.quartz.JobDetail ‘s
    group.

 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 org.quartz.JobDetail .

 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 Scheduler should be given for
    handling misfire situations for this Trigger— the
    concrete Trigger type that you are using will have
    defined a set of additional MISFIRE_INSTRUCTION_XXX
    constants that may be passed to this method.

    If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.

 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 Trigger.

 public  void setPriority(int priority) 
{
        this.priority = priority;
}
    The priority of a Trigger acts as a tiebreaker such that if
    two Triggers have the same scheduled fire time, then the
    one with the higher priority will get first access to a worker
    thread.

    If not explicitly set, the default value is 5.

 abstract public  void setStartTime(Date startTime)
 public  void setVolatility(boolean volatility) 
{
        this.volatility = volatility;
}

    Set whether or not the Trigger should be persisted in the
    org.quartz.spi.JobStore for re-use after program
    restarts.

 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 Scheduler has decided to 'fire' the trigger (execute the associated Job), in order to give the Trigger a chance to update itself for its next triggering (if any).

 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 Trigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when the Trigger was created.

 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 Trigger's state based on the given new version of the associated Calendar (the state should be updated so that it's next fire time is appropriate given the Calendar's new settings).

 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 JobDetail are
    valid for submission into a Scheduler.

 abstract protected boolean validateMisfireInstruction(int misfireInstruction)
/* * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the «License»); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an «AS IS» BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * */ package org.quartz; import java.io.Serializable; import java.util.Comparator; import java.util.Date; /** * The base interface with properties common to all <code>Trigger</code>s — * use {@link TriggerBuilder} to instantiate an actual Trigger. * * <p> * <code>Triggers</code>s have a {@link TriggerKey} associated with them, which * should uniquely identify them within a single <code>{@link Scheduler}</code>. * </p> * * <p> * <code>Trigger</code>s are the ‘mechanism’ by which <code>Job</code>s * are scheduled. Many <code>Trigger</code>s can point to the same <code>Job</code>, * but a single <code>Trigger</code> can only point to one <code>Job</code>. * </p> * * <p> * Triggers can ‘send’ parameters/data to <code>Job</code>s by placing contents * into the <code>JobDataMap</code> on the <code>Trigger</code>. * </p> * * @see TriggerBuilder * @see JobDataMap * @see JobExecutionContext * @see TriggerUtils * @see SimpleTrigger * @see CronTrigger * @see CalendarIntervalTrigger * * @author James House */ public interface Trigger extends Serializable, Cloneable, Comparable<Trigger> { public static final long serialVersionUID = —3904243490805975570L; public enum TriggerState { NONE, NORMAL, PAUSED, COMPLETE, ERROR, BLOCKED } /** * <p><code>NOOP</code> Instructs the <code>{@link Scheduler}</code> that the * <code>{@link Trigger}</code> has no further instructions.</p> * * <p><code>RE_EXECUTE_JOB</code> Instructs the <code>{@link Scheduler}</code> that the * <code>{@link Trigger}</code> wants the <code>{@link org.quartz.JobDetail}</code> to * re-execute immediately. If not in a ‘RECOVERING’ or ‘FAILED_OVER’ situation, the * execution context will be re-used (giving the <code>Job</code> the * ability to ‘see’ anything placed in the context by its last execution).</p> * * <p><code>SET_TRIGGER_COMPLETE</code> Instructs the <code>{@link Scheduler}</code> that the * <code>{@link Trigger}</code> should be put in the <code>COMPLETE</code> state.</p> * * <p><code>DELETE_TRIGGER</code> Instructs the <code>{@link Scheduler}</code> that the * <code>{@link Trigger}</code> wants itself deleted.</p> * * <p><code>SET_ALL_JOB_TRIGGERS_COMPLETE</code> Instructs the <code>{@link Scheduler}</code> * that all <code>Trigger</code>s referencing the same <code>{@link org.quartz.JobDetail}</code> * as this one should be put in the <code>COMPLETE</code> state.</p> * * <p><code>SET_TRIGGER_ERROR</code> Instructs the <code>{@link Scheduler}</code> that all * <code>Trigger</code>s referencing the same <code>{@link org.quartz.JobDetail}</code> as * this one should be put in the <code>ERROR</code> state.</p> * * <p><code>SET_ALL_JOB_TRIGGERS_ERROR</code> Instructs the <code>{@link Scheduler}</code> that * the <code>Trigger</code> should be put in the <code>ERROR</code> state.</p> */ public enum CompletedExecutionInstruction { NOOP, RE_EXECUTE_JOB, SET_TRIGGER_COMPLETE, DELETE_TRIGGER, SET_ALL_JOB_TRIGGERS_COMPLETE, SET_TRIGGER_ERROR, SET_ALL_JOB_TRIGGERS_ERROR } /** * Instructs the <code>{@link Scheduler}</code> that upon a mis-fire * situation, the <code>updateAfterMisfire()</code> method will be called * on the <code>Trigger</code> to determine the mis-fire instruction, * which logic will be trigger-implementation-dependent. * * <p> * In order to see if this instruction fits your needs, you should look at * the documentation for the <code>updateAfterMisfire()</code> method * on the particular <code>Trigger</code> implementation you are using. * </p> */ public static final int MISFIRE_INSTRUCTION_SMART_POLICY = 0; /** * Instructs the <code>{@link Scheduler}</code> that the * <code>Trigger</code> will never be evaluated for a misfire situation, * and that the scheduler will simply try to fire it as soon as it can, * and then update the Trigger as if it had fired at the proper time. * * <p>NOTE: if a trigger uses this instruction, and it has missed * several of its scheduled firings, then several rapid firings may occur * as the trigger attempt to catch back up to where it would have been. * For example, a SimpleTrigger that fires every 15 seconds which has * misfired for 5 minutes will fire 20 times once it gets the chance to * fire.</p> */ public static final int MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY = —1; /** * The default value for priority. */ public static final int DEFAULT_PRIORITY = 5; public TriggerKey getKey(); public JobKey getJobKey(); /** * Return the description given to the <code>Trigger</code> instance by * its creator (if any). * * @return null if no description was set. */ public String getDescription(); /** * Get the name of the <code>{@link Calendar}</code> associated with this * Trigger. * * @return <code>null</code> if there is no associated Calendar. */ public String getCalendarName(); /** * Get the <code>JobDataMap</code> that is associated with the * <code>Trigger</code>. * * <p> * Changes made to this map during job execution are not re-persisted, and * in fact typically result in an <code>IllegalStateException</code>. * </p> */ public JobDataMap getJobDataMap(); /** * The priority of a <code>Trigger</code> acts as a tiebreaker such that if * two <code>Trigger</code>s have the same scheduled fire time, then the * one with the higher priority will get first access to a worker * thread. * * <p> * If not explicitly set, the default value is <code>5</code>. * </p> * * @see #DEFAULT_PRIORITY */ public int getPriority(); /** * Used by the <code>{@link Scheduler}</code> to determine whether or not * it is possible for this <code>Trigger</code> to fire again. * * <p> * If the returned value is <code>false</code> then the <code>Scheduler</code> * may remove the <code>Trigger</code> from the <code>{@link org.quartz.spi.JobStore}</code>. * </p> */ public boolean mayFireAgain(); /** * Get the time at which the <code>Trigger</code> should occur. */ public Date getStartTime(); /** * Get the time at which the <code>Trigger</code> should quit repeating — * regardless of any remaining repeats (based on the trigger’s particular * repeat settings). * * @see #getFinalFireTime() */ public Date getEndTime(); /** * Returns the next time at which the <code>Trigger</code> is scheduled to fire. If * the trigger will not fire again, <code>null</code> will be returned. Note that * the time returned can possibly be in the past, if the time that was computed * for the trigger to next fire has already arrived, but the scheduler has not yet * been able to fire the trigger (which would likely be due to lack of resources * e.g. threads). * * <p>The value returned is not guaranteed to be valid until after the <code>Trigger</code> * has been added to the scheduler. * </p> * * @see TriggerUtils#computeFireTimesBetween(org.quartz.spi.OperableTrigger, Calendar, java.util.Date, java.util.Date) */ public Date getNextFireTime(); /** * Returns the previous time at which the <code>Trigger</code> fired. * If the trigger has not yet fired, <code>null</code> will be returned. */ public Date getPreviousFireTime(); /** * Returns the next time at which the <code>Trigger</code> will fire, * after the given time. If the trigger will not fire after the given time, * <code>null</code> will be returned. */ public Date getFireTimeAfter(Date afterTime); /** * Returns the last time at which the <code>Trigger</code> will fire, if * the Trigger will repeat indefinitely, null will be returned. * * <p> * Note that the return time *may* be in the past. * </p> */ public Date getFinalFireTime(); /** * Get the instruction the <code>Scheduler</code> should be given for * handling misfire situations for this <code>Trigger</code>- the * concrete <code>Trigger</code> type that you are using will have * defined a set of additional <code>MISFIRE_INSTRUCTION_XXX</code> * constants that may be set as this property’s value. * * <p> * If not explicitly set, the default value is <code>MISFIRE_INSTRUCTION_SMART_POLICY</code>. * </p> * * @see #MISFIRE_INSTRUCTION_SMART_POLICY * @see SimpleTrigger * @see CronTrigger */ public int getMisfireInstruction(); /** * Get a {@link TriggerBuilder} that is configured to produce a * <code>Trigger</code> identical to this one. * * @see #getScheduleBuilder() */ public TriggerBuilder<? extends Trigger> getTriggerBuilder(); /** * Get a {@link ScheduleBuilder} that is configured to produce a * schedule identical to this trigger’s schedule. * * @see #getTriggerBuilder() */ public ScheduleBuilder<? extends Trigger> getScheduleBuilder(); /** * Trigger equality is based upon the equality of the TriggerKey. * * @return true if the key of this Trigger equals that of the given Trigger. */ public boolean equals(Object other); /** * <p> * Compare the next fire time of this <code>Trigger</code> to that of * another by comparing their keys, or in other words, sorts them * according to the natural (i.e. alphabetical) order of their keys. * </p> */ public int compareTo(Trigger other); /** * A Comparator that compares trigger’s next fire times, or in other words, * sorts them according to earliest next fire time. If the fire times are * the same, then the triggers are sorted according to priority (highest * value first), if the priorities are the same, then they are sorted * by key. */ class TriggerTimeComparator implements Comparator<Trigger>, Serializable { private static final long serialVersionUID = —3904243490805975570L; // This static method exists for comparator in TC clustered quartz public static int compare(Date nextFireTime1, int priority1, TriggerKey key1, Date nextFireTime2, int priority2, TriggerKey key2) { if (nextFireTime1 != null || nextFireTime2 != null) { if (nextFireTime1 == null) { return 1; } if (nextFireTime2 == null) { return1; } if(nextFireTime1.before(nextFireTime2)) { return1; } if(nextFireTime1.after(nextFireTime2)) { return 1; } } int comp = priority2priority1; if (comp != 0) { return comp; } return key1.compareTo(key2); } public int compare(Trigger t1, Trigger t2) { return compare(t1.getNextFireTime(), t1.getPriority(), t1.getKey(), t2.getNextFireTime(), t2.getPriority(), t2.getKey()); } } }

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

Понравилась статья? Поделить с друзьями:
  • Quantum error скачать торрент на русском
  • Quantum error скачать торрент механики
  • Quantum error системные требования
  • Quantum error обзор
  • Quantum error дата выхода на пк