Quartz Scheduler Developer Guide : Advanced Features : JTA Transactions
JTA Transactions
JobStoreCMT allows Quartz scheduling operations to be performed within larger JTA transactions.
Jobs can also execute within a JTA transaction (UserTransaction) by setting the org.quartz.scheduler.wrapJobExecutionInUserTransaction property to true. With this option set, a a JTA transaction will begin() just before the Job's execute method is called, and commit() just after the call to execute terminates. This applies to all jobs.
If you would like to indicate per job whether a JTA transaction should wrap its execution, then you should use the @ExecuteInJTATransaction annotation on the job class.
Aside from Quartz automatically wrapping Job executions in JTA transactions, calls you make on the Scheduler interface also participate in transactions when using JobStoreCMT. Just make sure you've started a transaction before calling a method on the scheduler. You can do this either directly, through the use of UserTransaction, or by putting your code that uses the scheduler within a SessionBean that uses container-managed transactions.
Copyright © 2010-2016 Software AG, Darmstadt, Germany.

Product Logo |   Feedback