|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.jta.SpringJtaSynchronizationAdapter
public class SpringJtaSynchronizationAdapter
Adapter that implements the JTA Synchronization
interface delegating to an underlying Spring
TransactionSynchronization
.
Useful for synchronizing Spring resource management code with plain JTA / EJB CMT transactions, despite the original code being built for Spring transaction synchronization.
Transaction.registerSynchronization(javax.transaction.Synchronization)
,
TransactionSynchronization
Field Summary | |
---|---|
protected static Log |
logger
|
Constructor Summary | |
---|---|
SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization)
Create a new SpringJtaSynchronizationAdapter for the given Spring TransactionSynchronization and JTA TransactionManager. |
|
SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization,
TransactionManager jtaTransactionManager)
Create a new SpringJtaSynchronizationAdapter for the given Spring TransactionSynchronization and JTA TransactionManager. |
|
SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization,
UserTransaction jtaUserTransaction)
Create a new SpringJtaSynchronizationAdapter for the given Spring TransactionSynchronization and JTA TransactionManager. |
Method Summary | |
---|---|
void |
afterCompletion(int status)
JTA afterCompletion callback: invoked after commit/rollback. |
void |
beforeCompletion()
JTA beforeCompletion callback: just invoked before commit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Log logger
Constructor Detail |
---|
public SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization)
springSynchronization
- the Spring TransactionSynchronization to delegate topublic SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization, UserTransaction jtaUserTransaction)
Note that this adapter will never perform a rollback-only call on WebLogic,
since WebLogic Server is known to automatically mark the transaction as
rollback-only in case of a beforeCompletion
exception. Hence,
on WLS, this constructor is equivalent to the single-arg constructor.
springSynchronization
- the Spring TransactionSynchronization to delegate tojtaUserTransaction
- the JTA UserTransaction to use for rollback-only
setting in case of an exception thrown in beforeCompletion
(can be omitted if the JTA provider itself marks the transaction rollback-only
in such a scenario, which is required by the JTA specification as of JTA 1.1).public SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization, TransactionManager jtaTransactionManager)
Note that this adapter will never perform a rollback-only call on WebLogic,
since WebLogic Server is known to automatically mark the transaction as
rollback-only in case of a beforeCompletion
exception. Hence,
on WLS, this constructor is equivalent to the single-arg constructor.
springSynchronization
- the Spring TransactionSynchronization to delegate tojtaTransactionManager
- the JTA TransactionManager to use for rollback-only
setting in case of an exception thrown in beforeCompletion
(can be omitted if the JTA provider itself marks the transaction rollback-only
in such a scenario, which is required by the JTA specification as of JTA 1.1)Method Detail |
---|
public void beforeCompletion()
beforeCompletion
callback: just invoked before commit.
In case of an exception, the JTA transaction will be marked as rollback-only.
beforeCompletion
in interface Synchronization
TransactionSynchronization.beforeCommit(boolean)
public void afterCompletion(int status)
afterCompletion
callback: invoked after commit/rollback.
Needs to invoke the Spring synchronization's beforeCompletion
at this late stage in case of a rollback, since there is no corresponding
callback with JTA.
afterCompletion
in interface Synchronization
TransactionSynchronization.beforeCompletion()
,
TransactionSynchronization.afterCompletion(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |