Transactions and the scheduler daemon
Scheduled BeanTaskInfo and MessageTaskInfo objects are guaranteed to execute only once. This is accomplished by grouping all of the work done in the task as a single unit of work. When each task fires, the following events occur in a single global transactional context:
Because all of a task's events are executed in a single global transactional context, you need to consider the following points in order to avoid transaction-related errors:
This includes the JDBC datasource configured for the scheduler, any JMS services used by the MessageTaskInfo objects, and any resources used within any of the UserCalendar, TaskHandler, or NotificationSink beans that have a transaction setting of "Requires".
Enable last participant support using the
Application Assembly Tool. On the WAS Enterprise tab for your enterprise
application, select the Accept heuristic hazard check box.
All unexpected exceptions are logged to the activity log and all events participating in the task's global transaction are rolled back. This includes changes to the task's database record, which force the task to be executed again when the scheduler daemon polls the database during the next poll cycle. The UserCalendar, TaskHandler, and NotificationSink beans can choose not to participate in the global transaction by setting the bean's transaction setting to "Requires new".
Transactions and the scheduler interface
All Scheduler interface methods participate in a single global transactional context. If a global transactional context is already present on the thread when the create(), suspend(), resume(), cancel(), and purge() methods are executed, the existing global transaction is used. Otherwise, a new global transaction begins.
If the method participates in the caller's global transaction and an unexpected error occurs, the transaction is marked to roll back. If the exception is a declared exception, then the exception is rethrown to the caller, and the transaction is left alone for the caller to commit or roll back.
If the method starts its own global transaction and any exception occurs, the transaction is rolled back, and the exception is rethrown to the caller.