18.5.1 Isolating Background Session State

APEX gives each background job its own session state so its changes stay separate from the user session.

When the APEX engine enqueues an execution chain's background process job, it:
  • Assigns a unique execution id to the new background process
  • Creates a new session for exclusive use by the new process
  • Clones the user session state to the new background process session.

From that moment, the background process has its own session state, separate from the user's. Each background process can read and write its own state as needed. However, changes in one background process do not affect the user session or any other background process.