Requirement
Run a batch in every other 15mins in the clock (i.e. clock time 00:15, 00:30, 00:45 01:00....).
Method 1 - create a schedulable
to run the batch every 15mins.
Pros: it allows me, in
execute()
method of schedulable, to check if the batch is already scheduled or running so it can abort if needed.Cons: I need to create 4 separate schedulable instances.
Method 2 - use System.scheduleBatch()
to run the batch every 15mins.
- Pros: no need to create 4 instances
- Cons: it seems no place/hook to allow me to check
if already scheduled or running
right before the batch starts.
Summary/Issue
No ideal solution, either way has opposite pros&cons.
start
method, I assume the batch has technically already been initiated thus I need to run system.abort to stop the current batch?