We are unclear about the Concurrent Batch Apex Limit of 5 and how to handle it.
We have a Managed Packed and want to utilize the Database.Batchable interface.
When using Database.Batchable interface with a QueryLocator is it possible to run into the Concurrent Batch Apex Limit?
If so I guess it is good practice to "handle" those limits like stated here:
https://help.salesforce.com/apex/HTViewSolution?id=000182449
//check if there are 5 active batch jobs
//In some cases, might need to add "Status='Queued' " to the criteria
if ([SELECT count() FROM AsyncApexJob WHERE JobType='BatchApex' AND (Status = 'Processing' OR Status = 'Preparing')] < 5){
Database.executeBatch(batchClassInstance);
} else {
//schedule this same schedulable class again in 30 mins
}
But then another question arises: Do I have to add the Status Queued or not?
Thanks