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 8850467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:54:38+00:00 2026-06-14T12:54:38+00:00

Okay I’ve looked through everything I can find and haven’t found an answer to

  • 0

Okay I’ve looked through everything I can find and haven’t found an answer to my issue. A couple items were close but not close enough. I have a Spring 3.0.7 based web app running in Tomcat 7. In the applicationContext.xml I have:

<task:scheduler id="scheduledReportsScheduler" pool-size="1"/> 
<task:scheduled-tasks scheduler="scheduledReportsScheduler"> 
        <task:scheduled ref="scheduledReportsQueuer" method="process" cron="0 */1 * * * *"/> 
</task:scheduled-tasks>
<bean id="scheduledReportsQueuer" class="com.foo.scheduledServices.ScheduledReportsQueuerService"></bean>

This executes my ScheduledReportsQueuerService class once every minute. That works fine. Then inside of that class I check some database tables and try to schedule tasks based on a CronTrigger if they haven’t already been scheduled:

if(!_workers.containsKey(schedule.getRptScheduleId())){
    _logger.debug(Thread.currentThread().getName() + " Creating and scheduling ScheduledReportQueuerWorker for scheduled report ID: "+schedule.getRptScheduleId()+"("+schedule.getReportName()+") "+schedule.getCronPattern());
    ScheduledReportQueuerWorker newWorker = new ScheduledReportQueuerWorker(schedule);
    newWorker.setRptRequestDAO(getRptRequestDao());
    newWorker.setRptScheduleDAO(getRptScheduleDao());
    _workers.put(schedule.getRptScheduleId(), newWorker);
    ScheduledFuture<?> newFuture = _scheduler.schedule(newWorker, new CronTrigger(schedule.getCronPattern()));
    _futures.put(schedule.getRptScheduleId(), newFuture);
}

private ConcurrentTaskScheduler _scheduler;

This also seems to work as the new tasks (newWorker above) are executed. The issue is they are getting executed multiple times at the correct trigger time. For instance if a new task has a cron pattern of ‘* */2 * * * *’ it should execute once every 2 minutes. Instead what is happening is the task is getting executed 50-60 times in a row every 2 minutes.

This is driving me nuts any help you can give would be great.

More info Here is some log output, you can see the XML based thread get started and it tells us we are creating a thread for one report to run every two minutes. Then you see that ever two minutes that report runs 60 times in a row.

// here it schedules a single report to be run every 2 minutes
2012-11-19 08:30:02,876 DEBUG - ScheduledReportsQueuerService - scheduledReportsScheduler-1 Creating and scheduling ScheduledReportQueuerWorker for scheduled report ID: 20182(Jasper Test Report 1) * */2 * * * *

// here the worker thread gets kicked off 57 times
2012-11-19 08:30:03,016 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)
...
2012-11-19 08:30:59,012 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)

// two minutes later the worker thread gets kicked off 60 times
2012-11-19 08:32:00,017 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)
...
2012-11-19 08:32:59,003 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)

// two minutes later the worker thread gets kicked off 60 times
2012-11-19 08:34:00,019 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)
...
2012-11-19 08:34:59,014 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)

// two minutes later the worker thread gets kicked off 60 times
2012-11-19 08:36:00,010 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)
...
2012-11-19 08:36:59,006 INFO  - workers.ScheduledReportQueuerWorker - !!!!!!!!!!!!! 20182 (* */2 * * * *)
  • 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-14T12:54:39+00:00Added an answer on June 14, 2026 at 12:54 pm

    Got it. Now I feel stupid. Turns out I wasn’t understanding the cron pattern. I used

    * */2 * * * * 
    

    thinking that should run once every two minutes. what that really does is once every two minutes run it for every second that has passed since the last trigger. The correct pattern is:

    0 */2 * * * *
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I've seen but haven't programmed in C# before. You can assume I'm competent
Okay, so the answer to my question might not be the problem but here's
OKay, this is probably pretty noob, but I couldn't find how to solve it.
Okay, I haven't used Interface Builder since Xcode 3.x but I remember there being
Okay I've spent the last hour trying to find a solution to this but
Okay, so I know that using eval() isn't great, but I haven't been able
Okay I got some good advice for Mobile Detection but still having an issue
Okay, first time asking a question usually i can find these kinds of answers
Okay, I feel a bit foolish for having to ask this but I guess
Okay, this is probably a very basic question; but, I'm just getting back in

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.