I wrote this class:
public with sharing class QueueTest1 implements Queueable, Finalizer{
public QueueTest1(){
}
public void execute(FinalizerContext param1) {
System.debug('param1 -> '+param1);
}
public void execute(QueueableContext param1) {
while (true){
}
}
}
And used anonymous apex to executed this 4-5 times:
for (Integer i = 0; i < 50; i++) {
System.enqueueJob(new QueueTest1());
}
I was able to see in Apex Jobs, there were 200 Queueable jobs queued with few statuses as Processing
and few as Queued
.
And saw that Flex queue was still empty, as Queueable is not inserted to flex queue.
1. where does Queueable gets queued if not in flex Queue. Does that have any limit?
Also when I was refreshing screen of "Apex Jobs" I was able to see this error.
2. Is this because as there is an infinite loop in the my Queueable class, or because salesforce is trying to run more than 5 Queueables in a synchronous manner?
3. What happens to batch in the above scenario if the code tries to add a batch. Does it get added to FlexQueue, or it will get executed only after all Queued
Queueables are finished, or will it get executed as soon as batch is executed?