How to schedule multiple jobs in the quartz scheduler using the same trigger?

I am using a quartz planner in my spring project. Do I need to start work after another work that is scheduled to run every 15 minutes? I cannot start this work at the same time, since both of these tasks must have access to the same email account using different protocols (one for sending: smtp and the other for receiving: imap), and this can cause problems. Answer quickly as an urgent requirement.

+3
source share
2 answers

You can do something about writing a task listener to find out when the first task ends and start it. But the solution, first proposed by mindas, is simpler - wrap both your jobs in a different Job implementation that you are actually planning.

0
source

Just write a shell class that runs the second job after the first. You can then reuse individual tasks in the future if you need to.

+2
source

Source: https://habr.com/ru/post/1741889/


All Articles