Announcement Announcement Module
Collapse
No announcement yet.
Quartz misfires not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz misfires not working

    I have a cronTrigger which should fire once each night, and in case my standalone application was not alive at that time, I want quartz to fire the trigger when starting up (only once by the way, even if a week passed and trigger should have fired 7 times...).

    But I am unable to get any kind of misfires to happen.

    Using Quartz 1.5.2 and Spring 2.0.

    I have a test job that I am firing each minute:

    Code:
    public class TestJobBean extends QuartzJobBean implements StatefulJob {
    
    	private Log log = LogFactory.getLog(getClass());
    
    	public TestJobBean() {
    		log.debug("test job bean created");
    	}
    
    	@Override
    	protected void executeInternal(JobExecutionContext context)
    			throws JobExecutionException {
    		
    		log.debug("job executing");
    		log.debug("now=" + new Date());
    		log.debug("scheduled time=" + context.getScheduledFireTime());
    		log.debug("actual fire time=" + context.getFireTime());
    	}
    }
    I am expecting that when my application has been shut down for a couple of minutes, and I start it again, I should see job printing out sheduled time = X, actual fire time = Y where X << Y.

    Related Spring configs:

    Code:
        <bean id="testJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass" value="com.foo.someproject.scheduling.jobs.TestJobBean" />
        </bean>
    
        <bean id="testTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail" ref="testJobBean"/>
            <property name="cronExpression" value="0 * * * * ?" />
            <property name="misfireInstructionName" value="MISFIRE_INSTRUCTION_FIRE_ONCE_NOW" />
        </bean>
    
        <bean id="scheduler" 
            class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                    <ref bean="testTrigger" />
                </list>
            </property>
            <property name="jobFactory" ref="jobFactory" />
            <property name="schedulerContextAsMap">
                <map>
                    <entry key="travelTimeService" value-ref="travelTimeImportService" />
                    <entry key="travelTimeImportStatusService" value-ref="travelTimeImportStatusService" />
                </map>
            </property>
    
            <property name="configLocation">
                <value>classpath:quartz.properties</value>
            </property>        
    
            <property name="dataSource" ref="dataSource" />
            <property name="transactionManager" ref="transactionManager" />
            <property name="autoStartup" value="false" />
            <!-- check if this affects misfires -->
            <property name="overwriteExistingJobs" value="true" />
        </bean>
    
        <bean id="testBean" class="com.foo.someproject.TestBean">
            <property name="scheduler" ref="scheduler" />
        </bean>    
        
        <bean id="jobFactory" class="org.springframework.scheduling.quartz.SpringBeanJobFactory">
        </bean>
    Code:
    quartz.properties
    
    org.quartz.jobStore.misfireThreshold = 10000
    (I have tried without quartz.properties also, I am assuming it should use the default misfire threshold = 60s in that case?)

    After running and stopping my application the data in quartz tables:

    QRTZ_CRON_TRIGGERS: (trigger_name, trigger_group, cron_expression, time_zone_id)

    testTrigger DEFAULT 0 * * * * ? Europe/Helsinki

    QRTZ_FIRED_TRIGGERS = empty

    QRTZ_TRIGGERS (trigger_name, trigger_group, job_name, job_group, is_volatile, description, next_fire_time, prev_fire_time, trigger_state, trigger_type, start_time, end_time, calendar_name, misfire_instr, job_data):
    testTrigger DEFAULT testJobBean DEFAULT 0 1201005300000 1201005240000 WAITING CRON 1201005187000 0 1

    QRTZ_JOB_DETAILS (job_name, job_group, desctription, job_class_name, is_durable, is_volatile, is_stateful, requests_recovery, job_data):
    testJobBean DEFAULT com.foo.fooproject.scheduling.jobs.TestJobBean 0 0 1 0 (BLOB)

  • #2
    When I restart my app (I have a standalone Java app, not part of a web application), I get following in logs:

    Code:
    INFO - org.quartz.core.QuartzScheduler.<init>(195) | Quartz Scheduler v.1.5.2 created.
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: main
    INFO - org.quartz.impl.StdSchedulerFactory.instantiate(1014) | Quartz scheduler 'QuartzScheduler' initialized from an externally provided properties instan
    ce.
    INFO - org.quartz.impl.StdSchedulerFactory.instantiate(1018) | Quartz scheduler version: 1.5.2
    INFO - org.quartz.core.QuartzScheduler.setJobFactory(1853) | JobFactory set to: [email protected]3
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: main
    springggg initialized
    DEBUG - com.foo.someproject.App.foo(80) | testbean=com.foo.someproject.TestBean@cad437
    DEBUG - com.foo.someproject.App.foo(81) | testbean.scheduler=org.quartz.impl.StdScheduler@329572
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: main
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
    INFO - org.quartz.core.QuartzScheduler.start(400) | Scheduler QuartzScheduler_$_NON_CLUSTERED started.
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
    STERED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
    sfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
    D_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
    STERED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
    sfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
    D_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
    STERED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
    sfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
    D_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
    STERED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
    sfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
    D_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
    STERED_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
    sfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
    D_MisfireHandler
    DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
    ED_MisfireHandler

    Comment


    • #3
      Code:
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
      STERED_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
      sfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
      D_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - com.foo.someproject.scheduling.jobs.TestJobBean.<init>(17) | test job bean created
      DEBUG - org.quartz.core.JobRunShell.run(202) | Calling execute on job DEFAULT.testJobBean
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
      DEBUG - com.foo.someproject.scheduling.jobs.TestJobBean.executeInternal(24) | job executing
      DEBUG - com.foo.someproject.scheduling.jobs.TestJobBean.executeInternal(25) | now=Tue Jan 22 14:34:00 EET 2008
      DEBUG - com.foo.someproject.scheduling.jobs.TestJobBean.executeInternal(26) | scheduled time=Tue Jan 22 14:34:00 EET 2008
      DEBUG - com.foo.someproject.scheduling.jobs.TestJobBean.executeInternal(27) | actual fire time=Tue Jan 22 14:34:00 EET 2008
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_Worker-2
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_Worker-2
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_Worker-2
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_Worker-2
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzSchedulerThread
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
      ED_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
      STERED_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
      sfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
      D_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(121) | Lock 'TRIGGER_ACCESS' is desired by: QuartzScheduler_QuartzScheduler-NON_CLUSTER
      ED_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(134) | Lock 'TRIGGER_ACCESS' is being obtained: QuartzScheduler_QuartzScheduler-NON_CLU
      STERED_MisfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock(168) | Lock 'TRIGGER_ACCESS' given to: QuartzScheduler_QuartzScheduler-NON_CLUSTERED_Mi
      sfireHandler
      DEBUG - org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.releaseLock(193) | Lock 'TRIGGER_ACCESS' returned by: QuartzScheduler_QuartzScheduler-NON_CLUSTERE
      D_MisfireHandler
      I see some misifire-related logging, some locks are being handled, but it does not seem like any misfires are detected?

      Comment


      • #4
        Has anyone configured misfires successfully?

        Comment


        • #5
          Has anyone configured misfires successfully?
          Hmmm, do you mean on purpose?

          Back to business though, in your SchedulerFactoryBean, you want to have your autoStartup = true. That way, if your job is supposed to fire at midnight and your application is down from 11 to 1 am, when it comes back online, it will fire the job once, then it will be back on schedule.

          Good luck,

          Steve O

          Comment


          • #6
            Originally posted by Steve O View Post
            Hmmm, do you mean on purpose?

            Back to business though, in your SchedulerFactoryBean, you want to have your autoStartup = true. That way, if your job is supposed to fire at midnight and your application is down from 11 to 1 am, when it comes back online, it will fire the job once, then it will be back on schedule.

            Good luck,

            Steve O
            I am starting the scheduler manually each time my app starts. The reason I start it manually, is that otherwise my unit tests also start the scheduler and the jobs running mess up my tests.

            I could keep autoStartup = true by changing my test config a bit, but can that really be the reason why misfires are not handled, since I do start the scheduler manually each time?

            I am injecting the configured scheduler to my application's bean like this

            Code:
                <bean id="testBean" class="com.foo.fooProject.TestBean">
                    <property name="scheduler" ref="scheduler" />
                </bean>
            and triggering the startup manually

            Code:
                	testBean.getScheduler().start();
            And from the logs you can see that the scheduler is starting.

            Comment


            • #7
              I tried the bundled in misfire example exampel5, and I don't understand at all what is going on with the misfires. As far as I can understand, misifires don't seem to work at all like they should.

              Javadocs of org.quartz.examples.example.MisfireExample say that

              Code:
               * While the example is running, you should note that there are two triggers
               * with identical schedules, firing identical jobs. The triggers "want" to fire
               * every 3 seconds, but the jobs take 10 seconds to execute. Therefore, by the
               * time the jobs complete their execution, the triggers have already "misfired"
               * (unless the scheduler's "misfire threshold" has been set to more than 7
               * seconds). You should see that one of the jobs has its misfire instruction
               * set to <code>SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT</code>,
               * which causes it to fire immediately, when the misfire is detected. The other
               * trigger uses the default "smart policy" misfire instruction, which causes
               * the trigger to advance to its next fire time (skipping those that it has
               * missed) - so that it does not refire immediately, but rather at the next
               * scheduled time.
              Which I understand, should mean that when running the example I should see the two jobs starting and stopping at different times. They are not. Both jobs keep starting and stopping at same times. They start at :00, run for 10 seconds, finish at :10, immediately start again, finish next time at :20, start again immediately, etc.

              Code:
              -o-group1.statefulJob1 executing.[Mon Feb 04 14:06:00 EET 2008]
              -o-group1.statefulJob2 finished.[Mon Feb 04 14:06:00 EET 2008]
              [DEBUG] 04 helmi 02:06:00.078 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
              Producing instance of Job 'group1.statefulJob2', class=org.quartz.examples.example5.StatefulDumbJob
              
              [DEBUG] 04 helmi 02:06:00.078 PM DefaultQuartzScheduler_Worker-6 [org.quartz.core.JobRunShell]
              Calling execute on job group1.statefulJob2
              
              -o-group1.statefulJob2 executing.[Mon Feb 04 14:06:00 EET 2008]
              -o-group1.statefulJob1 finished.[Mon Feb 04 14:06:10 EET 2008]
              [DEBUG] 04 helmi 02:06:10.078 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
              Producing instance of Job 'group1.statefulJob1', class=org.quartz.examples.example5.StatefulDumbJob
              
              [DEBUG] 04 helmi 02:06:10.078 PM DefaultQuartzScheduler_Worker-1 [org.quartz.core.JobRunShell]
              Calling execute on job group1.statefulJob1
              
              -o-group1.statefulJob1 executing.[Mon Feb 04 14:06:10 EET 2008]
              -o-group1.statefulJob2 finished.[Mon Feb 04 14:06:10 EET 2008]
              [DEBUG] 04 helmi 02:06:10.093 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
              Producing instance of Job 'group1.statefulJob2', class=org.quartz.examples.example5.StatefulDumbJob
              
              [DEBUG] 04 helmi 02:06:10.093 PM DefaultQuartzScheduler_Worker-5 [org.quartz.core.JobRunShell]
              Calling execute on job group1.statefulJob2
              
              -o-group1.statefulJob2 executing.[Mon Feb 04 14:06:10 EET 2008]
              -o-group1.statefulJob1 finished.[Mon Feb 04 14:06:20 EET 2008]
              [DEBUG] 04 helmi 02:06:20.078 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
              Producing instance of Job 'group1.statefulJob1', class=org.quartz.examples.example5.StatefulDumbJob
              
              [DEBUG] 04 helmi 02:06:20.078 PM DefaultQuartzScheduler_Worker-3 [org.quartz.core.JobRunShell]
              Calling execute on job group1.statefulJob1
              
              -o-group1.statefulJob1 executing.[Mon Feb 04 14:06:20 EET 2008]
              -o-group1.statefulJob2 finished.[Mon Feb 04 14:06:20 EET 2008]
              [DEBUG] 04 helmi 02:06:20.093 PM DefaultQuartzScheduler_QuartzSchedulerThread [org.quartz.simpl.SimpleJobFactory]
              Producing instance of Job 'group1.statefulJob2', class=org.quartz.examples.example5.StatefulDumbJob
              
              [DEBUG] 04 helmi 02:06:20.093 PM DefaultQuartzScheduler_Worker-2 [org.quartz.core.JobRunShell]
              Calling execute on job group1.statefulJob2
              Are there some known issues with misfires on 1.5.2, am I doing something wrong, are the examples wrong, can anyone help? Does someone actually use the misfires successfully?

              Comment


              • #8
                It seems in example5 the both jobs handle misfires. They both detect that misfires have happened and fire the job immediately when it is possible.

                example javadocs say that the two jobs should handle misfires differently, but this does not seem to be true. Is there a bug with how the misfires are handled, or is the example wrong?

                I use persistent jobs and crontriggers, and I cant get misfires when starting the scheduler and cron times have been missed. Any ideas?

                Comment


                • #9
                  Oops. Meant to post these latest replies to the quartz forum.....well if anyone has any ideas here, I won't mind! :P

                  Comment


                  • #10
                    Finally got misfires working with CronTrigger as I would want them to.

                    1) <property name="overwriteExistingJobs" value="true" /> causes a problem, since it will overwrite all triggers when quartz starts up (doh!) - overwriting the NEXT_FIRE_TIME and hence never misfiring any triggers.

                    2) At some point I changed the misfire threshold to 1 "to make sure misfires are always detected" (some page actually suggested this solution) - well, this is not very good either since this way Quartz detects that the job has misfired, changes status to MISFIRED, calls trigger to determine next fire time, changes job status to WAITING with new fire time - and before the trigger has chance to fire, it is already updated to MISFIRED status again. So better use something like 5000 instead.

                    I am sure there were other overlapping issues as well, but I cannot describe other than these two anymore. Now the CronTrigger misfires work as I would expect.

                    I now use MISFIRE_INSTRUCTION_SMART_POLICY instead of MISFIRE_INSTRUCTION_FIRE_ONCE_NOW, not sure if this has any effect.

                    Comment


                    • #11
                      Quartz misfires not working

                      The issue is that the subsequent cron trigger has misfired and the cron trigger is currently set to ignore the misfires.
                      The initial reason for choosing this was to allow stop/start of Cron jobs to resume at the next trigger rather then firing immediately, but I had not foreseen this issue. It is only evident because I had reduced the misfire threshold.

                      I will change the misfire instruction to use MISFIRE_INSTRUCTION_FIRE_ONCE_NOW but, in the meantime, a workaround is to increase the misfire threshold as follows.


                      invitation letter
                      Last edited by invitation; Mar 8th, 2009, 03:45 AM. Reason: signatuer

                      Comment


                      • #12
                        Originally posted by jimpo View Post
                        Finally got misfires working with CronTrigger as I would want them to.

                        1) <property name="overwriteExistingJobs" value="true" /> causes a problem, since it will overwrite all triggers when quartz starts up (doh!) - overwriting the NEXT_FIRE_TIME and hence never misfiring any triggers.

                        2) At some point I changed the misfire threshold to 1 "to make sure misfires are always detected" (some page actually suggested this solution) - well, this is not very good either since this way Quartz detects that the job has misfired, changes status to MISFIRED, calls trigger to determine next fire time, changes job status to WAITING with new fire time - and before the trigger has chance to fire, it is already updated to MISFIRED status again. So better use something like 5000 instead.

                        I am sure there were other overlapping issues as well, but I cannot describe other than these two anymore. Now the CronTrigger misfires work as I would expect.

                        I now use MISFIRE_INSTRUCTION_SMART_POLICY instead of MISFIRE_INSTRUCTION_FIRE_ONCE_NOW, not sure if this has any effect.
                        Thanks jimpo. You apparently save me.
                        I was having same issue and <property name="overwriteExistingJobs" value="true" /> was the culprit. Although MISFIRE_INSTRUCTION_FIRE_ONCE_NOW is fine.

                        Comment


                        • #13
                          In my case i havent used xml file to define my job. And also my misfire is not working. My scheduler is scheduled to fire at midnight of any day but server is down when scheduler is supposed to fire. So when i start the server in morning scheduler is suppose to misfire but it is not. I observed the values in quartz_trigger table, the next_fire_time is getting automatically updated even when server is down. So i think it may be problem for this. So any solution for this? thanks in advance!

                          Comment

                          Working...
                          X