Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void testWithoutCallout(final Id leadId)
- {
- System.debug(DateTime.now().format('m:s') + ': Lock requested');
- final Lead lead = [Select id From Lead where id = :leadId FOR UPDATe];
- System.debug(DateTime.now().format('m:s') + ': Lock acquired');
- for(Integer i = 0; i < 30000000; i++) {}
- System.debug(DateTime.now().format('m:s') + ': Done');
- }
- public static void testWithCallout(final Id leadId)
- {
- System.debug(DateTime.now().format('m:s') + ': Lock requested');
- final Lead lead = [Select id From Lead where id = :leadId FOR UPDATe];
- System.debug(DateTime.now().format('m:s') + ': Lock acquired');
- final HttpRequest req = new HttpRequest();
- req.setEndPoint('https://www.google.de');
- req.setMethod('GET');
- final Http http = new Http();
- http.send(req);
- for(Integer i = 0; i < 30000000; i++) {}
- System.debug(DateTime.now().format('m:s') + ': Done');
- }
- Execution 1:
- 16:56: Lock requested
- 16:56: Lock acquired
- 17:02: Done
- Execution 2:
- 16:59: Lock requested
- 17:59: Lock acquired
- 17:17: Done
- Execution 1:
- 21:18: Lock requested
- 21:18: Lock acquired
- 21:34: Done
- Execution 2:
- 21:23: Lock requested
- 21:23: Lock acquired
- 21:38: Done
Add Comment
Please, Sign In to add comment