QUESTION: when you instantiate a class in a scheduled apex job, is the class instantiated at the time of the schedule, or at the scheduled time of execution?
Here's my situation... I have a custom object called Blast, which schedules a bulk SMS send. That object record includes a DateTime field that designates when the blast will happen; for this example, let's say the blast happens next Tuesday at 1:00 pm.
The blast has some unknown number of recipients -- very possibly 20-50k, which are stored as CampaignMembers. So, at the designated time, I have a batch apex class that retrieves all of the recipient info from the CampaignMember records and makes the api call.
When a user creates/updates the Blast record today and sets status to "queued", I'm creating a scheduled apex job, instantiating my batch apex class and providing the blast record, from which it pulls necessary data.
I want to build into the batch apex class a check that verifies the blast record still exists before executing the blast. But I'm not clear on whether that class is instantiated today (when the job is scheduled), or next Tuesday at 1:00pm when it has been scheduled to run.