I have a Play! Framework Job that executes every 30 seconds:
@Every("30s")
public class MyJob extends Job { ... }
This job does a few things such as reading e-mails and writing to the DB. However, it is possible that the job may not finish within 30 seconds. If the job takes longer than 30 seconds, I would like to kill the subsequent job that tries to start while the original job is still in progress. Is there a way to do this? or even pause the subsequent job until the original completes its work?
as far as I know you don't have to kill the job. I created a job than had to run every minute, but in some scenarios it could (potentially) run for longer than a minute.
I did some testing, and be aware that I may have done them in the wrong way, but Play doesn't launch a new instance of the Job if it is already running. Once the job finishes, it will run the next instance in the expected time. Take it as if Play treats Jobs as "Singletons", only 1 of a given type active at a given time.
So, no, you don't need to kill or check anything. Awesome, isn't it? ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With