Skip to main content
Neha Dabas 提问于 #Apex
Both future methods and queueable apex are types of asynchronous apex. One of the differences between the two is that, future methods can only accept primitive data types parameters and not sObjects, and the reason for that is also justified that object state might change between when the method is called and when it is actually executed.

However we can pass sObjects to Queueable Apex. 

Please help me understand how is sObject state kept in sync in case of Queueable Apex.
2 个回答
  1. 2019年6月3日 16:54
    Hi Raj,

    I have been through these articles. What I am trying to ask is, how are sObjects allowed in Queueable apex, are they passed by reference? 

    As "The reason why sObjects can’t be passed as arguments to future methods is because the sObject might change between the time you call the method and the time it executes. In this case, the future method will get the old sObject values and might overwrite them" this reason should apply to all the async methods. How is it made sure, that sObject doesnot change between when Queueable apex is called and when it is actually executed?

    I hope I could make my point more clear this time.
0/9000