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
nitsnits 

Concurrent access to web service. Do for loops required

I have web service in SFDC which willbe accessed by UI in java by n number of users(concurrently)
 
global class Pipeline {

  WebService static opportunity[] Apptaker(string adid, string Ftype, date Frmdt, date todt, string stype, string sorder) {

opportunity[] opp;
SOQL1
 
return opp;
}
 
 
 
There is only one SOQL1 in the code which will be executed.
Now for concurrent callouts to the API do I need to incorporate for loops.
In case for loop is placed, shall I see the error of governor limits in number of SOQL queries per code.
SuperfellSuperfell
I don't really follow the question, but if your web service is only doing queries, then it is already concurrent safe, you don't need to do anything different in apex to handle the fact that it might be called concurrently.

Apex Web Services are subject to the same max requests/max concurrent requests limits that the regular api is subject to (as detailed in the API docs)
Ad_InfosysAd_Infosys

Actually I was just wondering.

As in triggers for bulk processing we write

for(Account a=trigger.new)

Is such for loop required in web service to handle multiple concurrent calls.
 
Thanks so much
SuperfellSuperfell
The for loop in a trigger is because the trigger is bulk processing, a single request may update/insert multiple rows, nothing to do with concurrency.
Ad_InfosysAd_Infosys
:smileyvery-happy: Thanks Atonne