You need to sign in to do that
Don't have an account?

What does "Maximum number of Apex classes scheduled concurrently" actually mean
Hi.
I'm trying to write some Apex code to make sure I don't run into any govenor limits. One of the limits is described as "Maximum number of Apex classes scheduled concurrently", limited to 100.
Presumably I need to look in AsyncApexJob, but what exactly should I be looking for? All records with a status of Queued, Processing, Preparing and Holding?
Thanks,
Carl
I'm trying to write some Apex code to make sure I don't run into any govenor limits. One of the limits is described as "Maximum number of Apex classes scheduled concurrently", limited to 100.
Presumably I need to look in AsyncApexJob, but what exactly should I be looking for? All records with a status of Queued, Processing, Preparing and Holding?
Thanks,
Carl
Before scheduling any apex job you can count a number of batch jobs that are running concurrently at the moment. If the count is greater than 5 then avoid scheduling the batch job else schedule the job.
Below is the query;
if([select count() from AsyncApexJob where status IN ( 'Processing', 'Queued','Preparing')] < 5)
{
//schedule the batch job using system.schedule method
}
Thanks for the reply. Unfortunately it doesn't answer my question. I understand that there is a limit of 5 for batch jobs, however I was asking about the limit of 100 concurrent Apex classes. For example, does this mean that I can have as many concurrent jobs (e.g. future jobs) as I like as long as they are all the same class?
Regards,
Carl