Skip to main content
Balaji Srinivasan (abc) a posé une question dans #Trailhead
I understand that you could pass collection of Sobjects to Queueable apex classes but not to future methods where we're restricted to only primitive collections. The reason it's not done for future methods is that the objects could potentially change from the time it's passed to the time when the future method executes.

Question - Will this hypothesis not hold true for Queueable apex and even batch apex for that matter (record value/criteria could change from when it's executed by the start method to when it's processed by the execute method when processing large sets of batches -- unless you completely take the sf org down for maitenance, in which case, this shouldn't be an issue for both queuable and batch apex) - Is that an expectation for both Queueable and Batch apex? or are there any alternatives?

Just wanted to get the group's thoughts on this one.
2 réponses
  1. 8 mars 2016, 18:22
    You can pass collection or sObjects to Queueable Apex but the underlying data may also change by the time the Apex executes. You typically don't have this problem with Batch Apex.

    Jeff Douglas

    Trailhead Developer Advocate