• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

[Quartz Job] Jobs do not execute at the same time

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Is there any way to execute multiple Jobs at the same time? I have programing multiple jobs to exexute at the same time but there were not execute at the time, for example I have programing 6 jobs to execute at 13:45:00, all at the same time, and there were the results:

Scheduled Job 2021/08/14 13:45:02
Scheduled Job 2021/08/14 13:45:06
Scheduled Job 2021/08/14 13:45:10
Scheduled Job 2021/08/14 13:45:14
Scheduled Job 2021/08/14 13:45:18
Scheduled Job 2021/08/14 13:45:22

I have the property of multiple threads enable

org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=25
org.quartz.threadPool.threadPriority=5

I hope you can help me.
 
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Being based on Java threads, it's a good idea not to assume that such jobs will all execute at precisely the same time. I strongly doubt that there is a way to make them do so. As the javadocs of the Thread class explain, it's also a good idea not to rely on thread priorities.
 
Nguyen Huy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Let's say the jobs are executed at 13:45:00 but I don't want these jobs to execute after the 30th second i.e. pass the time of 13:45:30 if I have more than 1000 jobs then the probability of passing 13:45:30 is high, so it won't be right for my use.
What ideas do you have to execute 1000+ jobs without exceeding 30 seconds?, meaning 1000+ jobs are completed within 30 seconds.
 
Tim Moores
Saloon Keeper
Posts: 7162
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is precise timing to the second so important? If the hardware can't handle the jobs it needs to handle in an acceptable time, you're going to have to use more powerful hardware.
 
Saloon Keeper
Posts: 24499
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Task schedulers generally do not run precisely at an indicated time. Often, in fact, they will be delayed to keep the overall system load in balance.

Aside from that, however, "cron" style tasks are not guaranteed scheduling precision to the fraction of a minute.

If absolute timing of a single task is essential, about the best you're going to be able to do is wake up a few minutes early and keep polling a precision clock - which, by the way, isn't the CPU hardware clock. Those things are constantly having to be adjusted. You'd need special hardware like an atomic clock or at least a GPS time reference.

And forget about precision timing on the execution of multiple concurrent threads. That can be thrown off by a whole raft of things from the number of physical cores, bus timings, bubbles in processor pipelines all the way up to which scheduling algorithm is currently being used.

General-purpose processing systems have mechanisms to allow threads to synchronize, but not to keep or follow precise time or execution between sync points. You need special hardware for stuff like that.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic