function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
santhoshreddy vanchasanthoshreddy vancha 

how to write synchronous batch apex ? it is possible or not ?

GauravGargGauravGarg
Hi Santosh,

You can "Queueable Interface" instead of Batch job. 

Please take look over this link: 
https://developer.salesforce.com/forums/?id=906F0000000kK6VIAU

Thanks,
Gaurav
Amit Chaudhary 8Amit Chaudhary 8

Asynchronous vs. Synchronous Execution:-

The difference between synchronous and asynchronous execution may seem a bit confusing at first. Program execution in most high-level languages is usually very straightforward. Your program starts at the first line of source code and each line of code executed sequentially thereafter. Easy enough.
 
Synchronous program execution is somewhat similar to the above. Your program is executed line by line, one line at a time. Each time a function is called, program execution waits until that function returns before continuing to the next line of code.
 
This method of execution can have undesirable ramifications. Suppose a function is called to start a time consuming process. What if you want to stop the lengthy process? With synchronous execution, your program is “stuck,” waiting for the process to end, with no way out.
 
Asynchronous execution avoids this bottleneck. You are essentially saying, “I know this function call is going to take a great deal of time, but my program doesn’t want to wait around while it executes.”
 
 
For more details read the below blogs,
 
http://learn4sfdc.blogspot.in/2012/02/synchronous-and-asynchronous-calls-with_27.html
 
http://www.bisque.com/help/ccdsoft/asynchronous_vs._synchronous_execution.htm
 
This may helpful for you..!
 
santhoshreddy vanchasanthoshreddy vancha
Queueable is an Asynchronous mehtod .how to  write   synchronously ?
GauravGargGauravGarg
Hi Santosh,

You can try using below link:

http://opfocus.com/queueableinteface_for_async_apex/

Thanks,
Gaurav
Skype: gaurav62990
Amit Chaudhary 8Amit Chaudhary 8
Hi santhoshreddy vancha,

Trigger is synchronously process.

Trigger :-
1) synchronously process
2) You can do 100 SOQL per cycle
3) Trigger process 200 in one context

Batch job:-
1) asynchronously process
2) 200 SOQL per cycle
3) Depend of batch job size.