Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the difference between */10 and 0/10 in Quartz Scheduler

We’re using Quartz jobs on the project.

I don’t understand the subtle difference between these two Cron expressions used in Quartz:

*/10 * * * * ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

and

0/10 * * * * ?

Does the former mean "Trigger your job every 10 seconds from now on"?

Whereas the latter means "Trigger the job every 10 seconds starting at xx:yy:00 in the next minute"?

So, for example, if the current time is 16:32:47, the job shall get triggered at:

  • 16:33:00
  • 16:33:10
  • 16:33:20
  • 16:33:30
  • 16:33:40
  • 16:33:50
  • 16:34:00
  • 16:34:10

etc.?

>Solution :

*/10 * * * * ? means every tenth second – e.g., 16:00:00, 16:00:10, 16:00:20, etc.

0/10 * * * * ? means every tenth second, starting with 0, which is as you alluded to, not very useful, and it’s arguably easier to use the previous syntax.

The usecase for this syntax is for non-zero arguments, e.g.:
2/10 * * * * ? means every tenth second, starting with 2, so you’d get 16:00:02, 16:00:12, etc.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading