- July 12, 2017 at 11:56 am #20905Shubham #80
Difference between synchronous and asynchronous in apex
Asynchonous call vs Synchoronous CallJuly 12, 2017 at 12:19 pm #20910shariq #1
Synchronous Apex :-
Synchronous term means existing or occurring at the same time. Synchronous Apex means entire Apex code is executed in one single go.
Asynchronous Apex :-
Asynchronous term means not existing or occurring at the same time. Asynchronous apex is executed when resources are available. So any calling method which calls Asynchronous apex wont wait for outcome of Asynchronous call. Calling method will go on further execution in code. And Asynchronous execution happens in separate thread and then it will return to main program.July 13, 2017 at 4:38 am #20916Radhakrishna #41
An async call is queued up in Salesforce and run on a separate thread of execution. At this point it becomes decoupled from the calling action. That also means the calling action won’t block and wait for a response from the asycn call. Using the future annotation identifies methods that are executed asynchronously. They must also be static methods. There are some considerations to know when using async methods.
you can learn more here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htmJuly 13, 2017 at 4:40 am #20917Radhakrishna #41
September 14, 2018 at 1:17 pm #34138Parul #2
- This reply was modified 1 year, 2 months ago by Radhakrishna.
In a Synchronous call, the thread will wait until it completes its tasks before proceeding to next. In a Synchronous call, the code runs in single thread.
In a Asynchronous call, the thread will not wait until it completes its tasks before proceeding to next. Instead it proceeds to next leaving it run in separate thread. In a Asynchronous call, the code runs in multiple threads which helps to do many tasks as background jobs.
Please Register to reply to this topic. /