Scheduler tasks and Java EE context
When a task is created using the Scheduler API create() method, the JEE (Java EE) thread context of the creator is stored with the scheduled task. When the task runs, the original Java EE thread context is reapplied to the thread before calling the customer TaskInfo instance.
The scheduler service utilizes the asynchronous beans deferred start mechanism to propagate Java EE service context information to a task when it runs. The amount of service context information that is propagated is controlled by the Service Context settings on the WorkManager configuration object that schedulers reference. For example, security and internationalization service contexts can be enabled. See the Using asynchronous beans topic for details on how to configure the Application Server to propagate these service contexts.
- Transactions and schedulers
The scheduler runs a task in a single global transaction, by default. Use the QOS_ONLYONCE or QOS_ATLEASTONCE quality of service to specify whether the task runs as a single unit of work once or as independent transactions.
- Scheduler task user authorization
The scheduler service uses the asynchronous beans deferred start mechanism to propagate JEE service context information to a task when it runs. If we plan to secure the application using the JAAS security context of the administrative security mechanism built into WebSphere Application Server, create each task with the correct credentials on the thread.
Related tasks
Secure scheduler tasks Use asynchronous beans Concept topic