Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Synchronous
Limit
100
Asynchronous
Limit
200
50,000
10,000
20
2,000
150
10,000
16
100
120 seconds
50
50
10
6 MB
10,000
milliseconds
10 minutes
10
2,000
12 MB
60,000
milliseconds
Synchronous
Limit
100
Asynchronous
Limit
200
50,000
Batch Apex
Scheduled Apex
Name
getJobI
D
Argument
s
Return
s
ID
Description
Returns the ID of the AsyncApexJob object associated
with this batch job as a string. Use this method to track the
progress of records in the batch job. You can also use this
ID with the System.abortJob method.
3 Test.stopTest();
Is it possible to call future method from a batch class?
We cannot call one asynchronous process from another asynchronous process.
Since @future method and Batch Class both are asynchronous we cannot call future method
from batch class or we cannot call batch class from the future method.
How to maintain the state between the methods of batch class?
By default batch class is stateless (variable value which is stored in one method cannot be
remembered in another method).
To maintain the state for the batch class, we should inherit Database.Stateful interface.
Scenario: In a set list of emails are stored in execute method. In the finish method that set is not
having any emails. What is the reason?
Answer: By default batch class is stateless. Emails which are added to set can be remembered
only in execute method. If we try to access the set in finish method you won't see those emails.
In finish method if you want to access those emails of that set we should inherit the interface
called Database.Stateful.
How to schedule batch apex in minutes/hours?
To schedule the batch class in minutes/hours, in the finish method we should use
System.schedule method which will take 3 parameters Job Name, Chrone Expression and
schedulable class instance name respectively.
How to schedule batch apex?
To schedule the batch class we should write a separate class by implementing Schedulable
interface.
After writing the above mentioned class to schedule navigates to: Develop> Apex Classes>
Schedule Apex.
By clicking on Schedule Apex button we can schedule the batch class through user interface.
Note: Through user interface we cannot schedule in hours/minutes.
27.Is the state of data is maintained between the Batch Apex execute methods?
28.What is Database.Stateful Interface?
29.When do we use Database.Stateful Interface?
30.If we use Database.Stateful Interface then state of static variables is maintained?
31.Can we call webserivce callouts from the Batch apex?
32.What is the use of Database.AllowCallouts?
33.How many Callouts we can call in each execute()?
34.Can we call future method in execute method of the batch apex?
35.Can a class have both Database.Batchable and ScheduleApex on a same class?
36.When we have divided the job in to five batches and if any one of the batch job fails
what will happen to other jobs?