I thought I was being clever by putting my Scheduled job classes inside a wrapper class:
global class Scheduler {
global class Foo implements System.Schedulable {
global void execute(SchedulableContext sc) {
//Foo stuff
}
}
global class Bar implements System.Schedulable {
global void execute(SchedulableContext sc) {
//Bar stuff
}
}
}
However once scheduled, any code inside the execute()
block either silently fails or does absolutely nothing. Not even logging occurs.
The jobs look completely normal. Everything is scheduled correctly and says that my jobs are firing and logs a PreviousFireTime when monitoring with this SOQL query:
SELECT CreatedDate,CreatedById,CreatedBy.Name,CronExpression,EndTime,TimesTriggered,State,NextFireTime,PreviousFireTime,StartTime,CronJobDetail.Name,CronJobDetail.JobType,Id
FROM CronTrigger
I can't think of any namespace collisions that could be happening and the System.schedule() method is using dependency injection--so I wouldn't think using an inner class would matter. At the very least, would assume the compiler would prevent me from saving if this was an issue.
I can't find any documentation that states a Scheduled class should be top-level. So I'm at a lost if this is a bug or an implementation issue?
execute
block does not fire? Have you tried throwing exceptions therein to be extra sure?