Home > Back-end >  Quarz can realize such timing task?
Quarz can realize such timing task?

Time:10-16

To perform a task 1, task 1 performed, over a period of time (such as 10 seconds) to perform a task 2, task 2 after a period of time (such as 20 seconds), to perform a task 1, has been loop


Note is 1 task execution, can excuse me such implementation? thank you

CodePudding user response:

I don't think it's two timing task, equivalent to a regular task has been executed, and the timing of task execution is two methods, two methods have a Thread between. Sleep in sleep,
The first method to perform after the return to perform successful state into a thread sleep, sleep over the execution of the second method, after the second method into the thread to sleep again, after the timing will end,
Because timing task has been executed (maybe is the second unit to perform timing task), timing task execution time to set up a true, end to set up a false to judge whether need to skip the current timing task,

I suggested this might be too stupid, but at a thirst, I also with you a perfect solution, such as

CodePudding user response:

This demand is a little bad ha
, however, is a big task: timing task 1 - task -- - task 1, 2 threads waiting for it

CodePudding user response:

Note is made of quartz can realize, not with Java thread
  • Related