Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:57:36+00:00 2026-06-12T17:57:36+00:00

I am having trouble with Quartz Scheduler. To be practical here you find my

  • 0

I am having trouble with Quartz Scheduler. To be practical here you find my code of unit test:

Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.getListenerManager().addSchedulerListener(schedulerTestListener); 

    Trigger trigger = newTrigger()
            .withIdentity(CoreTestConstants.TEST_TRIGGER, CoreTestConstants.TEST_TRIGGER_GROUP)
            .withSchedule(simpleSchedule()
                    .withMisfireHandlingInstructionIgnoreMisfires()
                    .withIntervalInMilliseconds(1000)
                    .repeatForever())
            .forJob(CoreTestConstants.TEST_JOB, CoreTestConstants.TEST_JOB_GROUP)
            .build(); 


scheduler.scheduleJob(getJobDetail(), trigger);

Thread.sleep(20000L);

scheduler.start();

The problem is, when the scheduler.scheduleJob(…) is executed I recognize that the task is not immediately started however when the scheduler.start() is executed I see that the 20 tasks is being executed immediately.

I mean, normally to my mind tasks should not be recorded or start until scheduler.start() is executed. But somehow the quartz system holds the state of tasks even before scheduler.start() is not executed, then when scheduler.start() call the missing task executions is triggered immediately.

Here the log:

09:32:45,005  INFO StdSchedulerFactory:1310 - Quartz scheduler version: 2.1.5
09:32:51,013  INFO SchedulerTest:47 - [test] Scheduler starting..
09:32:51,014  INFO QuartzScheduler:534 - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 1 / 1349850771037
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 2 / 1349850771040
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 3 / 1349850771040
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 4 / 1349850771041
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 5 / 1349850771042
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 6 / 1349850771043
*** [TIMER-TEST] 2012-10-10 09:32:51 / Test task is executed. Count: 7 / 1349850771044

As you can see even if I set the trigger to execute with interval in 1 seconds, it executed the missing tasks during thread sleep.

I tried to play around misfire instructions but it doesnt make a sense, it does not change the behaviour of the code in my case.

Any help would be appreciated. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:57:37+00:00Added an answer on June 12, 2026 at 5:57 pm

    OK your problem is with Thread.sleep(20000L); while waiting actually the jobs are triggered and scheduled therefore when start is fired all scheduled jobs are starting, you can put Thread.sleep up to Trigger trigger so that it will begin triggering and scheduling after waiting. Take a look for misfire policy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble getting unit tests set up for a specific scenario. Here's what I'm
Having trouble with each function... Will try to explain by example... In my code,
Having trouble accessing javascript code in a mixed html/js ajax response. jQuery ajax doc
Having trouble with the following segment of code. I'm getting a parameter count mismatch.
I'm having trouble getting a client/server implementation of Quartz.NET working. I have a SQL
Having trouble getting the following code to work. Calling swapLevel() directly works fine, but
I'm new to Quartz scheduling and I have grasped the basics. But I'm having
Having trouble where I think I need to provide most of my code to
Having trouble with iterator. It need to iterate over ArrayList and find any other
Having trouble to start a new activity after progressbar have loaded. Im getting stucked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.