|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.AbstractPlatformTransactionManager org.springframework.transaction.jta.JtaTransactionManager org.springframework.transaction.jta.WebLogicJtaTransactionManager
public class WebLogicJtaTransactionManager
Special JtaTransactionManager
variant for BEA WebLogic (9.0 and higher).
Supports the full power of Spring's transaction definitions on WebLogic's
transaction coordinator, beyond standard JTA: transaction names,
per-transaction isolation levels, and proper resuming of transactions in all cases.
Uses WebLogic's special begin(name)
method to start a JTA transaction,
in order to make Spring-driven transactions visible in WebLogic's transaction
monitor. In case of Spring's declarative transactions, the exposed name will
(by default) be the fully-qualified class name + "." + method name.
Supports a per-transaction isolation level through WebLogic's corresponding JTA transaction property "ISOLATION LEVEL". This will apply the specified isolation level (e.g. ISOLATION_SERIALIZABLE) to all JDBC Connections that participate in the given transaction.
Invokes WebLogic's special forceResume
method if standard JTA resume
failed, to also resume if the target transaction was marked rollback-only.
If you're not relying on this feature of transaction suspension in the first
place, Spring's standard JtaTransactionManager will behave properly too.
By default, the JTA UserTransaction and TransactionManager handles are
fetched directly from WebLogic's TransactionHelper
. This can be
overridden by specifying "userTransaction"/"userTransactionName" and
"transactionManager"/"transactionManagerName", passing in existing handles
or specifying corresponding JNDI locations to look up.
TransactionDefinition.getName()
,
TransactionDefinition.getIsolationLevel()
,
weblogic.transaction.UserTransaction#begin(String)
,
weblogic.transaction.Transaction#setProperty
,
weblogic.transaction.TransactionManager#forceResume
,
weblogic.transaction.TransactionHelper
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
---|
AbstractPlatformTransactionManager.SuspendedResourcesHolder |
Field Summary | |
---|---|
private java.lang.reflect.Method |
beginWithNameAndTimeoutMethod
|
private java.lang.reflect.Method |
beginWithNameMethod
|
private static java.lang.String |
CLIENT_TRANSACTION_MANAGER_CLASS_NAME
|
private java.lang.reflect.Method |
forceResumeMethod
|
private static java.lang.String |
ISOLATION_LEVEL_KEY
|
private java.lang.reflect.Method |
setPropertyMethod
|
private static java.lang.String |
TRANSACTION_CLASS_NAME
|
private static java.lang.String |
TRANSACTION_HELPER_CLASS_NAME
|
private java.lang.Object |
transactionHelper
|
private static java.lang.String |
USER_TRANSACTION_CLASS_NAME
|
private boolean |
weblogicTransactionManagerAvailable
|
private boolean |
weblogicUserTransactionAvailable
|
Fields inherited from class org.springframework.transaction.jta.JtaTransactionManager |
---|
DEFAULT_TRANSACTION_SYNCHRONIZATION_REGISTRY_NAME, DEFAULT_USER_TRANSACTION_NAME, FALLBACK_TRANSACTION_MANAGER_NAMES |
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
---|
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION |
Constructor Summary | |
---|---|
WebLogicJtaTransactionManager()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Initialize the UserTransaction as well as the TransactionManager handle. |
Transaction |
createTransaction(java.lang.String name,
int timeout)
Create an active Transaction object based on the given name and timeout. |
protected void |
doJtaBegin(JtaTransactionObject txObject,
TransactionDefinition definition)
Perform a JTA begin on the JTA UserTransaction or TransactionManager. |
protected void |
doJtaResume(JtaTransactionObject txObject,
java.lang.Object suspendedTransaction)
Perform a JTA resume on the JTA TransactionManager. |
private void |
loadWebLogicTransactionClasses()
|
private void |
loadWebLogicTransactionHelper()
|
protected TransactionManager |
retrieveTransactionManager()
Allows subclasses to retrieve the JTA TransactionManager in a vendor-specific manner. |
protected UserTransaction |
retrieveUserTransaction()
Allows subclasses to retrieve the JTA UserTransaction in a vendor-specific manner. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String USER_TRANSACTION_CLASS_NAME
private static final java.lang.String CLIENT_TRANSACTION_MANAGER_CLASS_NAME
private static final java.lang.String TRANSACTION_CLASS_NAME
private static final java.lang.String TRANSACTION_HELPER_CLASS_NAME
private static final java.lang.String ISOLATION_LEVEL_KEY
private boolean weblogicUserTransactionAvailable
private java.lang.reflect.Method beginWithNameMethod
private java.lang.reflect.Method beginWithNameAndTimeoutMethod
private boolean weblogicTransactionManagerAvailable
private java.lang.reflect.Method forceResumeMethod
private java.lang.reflect.Method setPropertyMethod
private java.lang.Object transactionHelper
Constructor Detail |
---|
public WebLogicJtaTransactionManager()
Method Detail |
---|
public void afterPropertiesSet() throws TransactionSystemException
JtaTransactionManager
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class JtaTransactionManager
TransactionSystemException
JtaTransactionManager.initUserTransactionAndTransactionManager()
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException
JtaTransactionManager
The default implementation simply returns null
.
retrieveUserTransaction
in class JtaTransactionManager
null
if none found
TransactionSystemException
- in case of errorsJtaTransactionManager.setUserTransaction(UserTransaction)
,
JtaTransactionManager.setUserTransactionName(java.lang.String)
protected TransactionManager retrieveTransactionManager() throws TransactionSystemException
JtaTransactionManager
The default implementation simply returns null
.
retrieveTransactionManager
in class JtaTransactionManager
null
if none found
TransactionSystemException
- in case of errorsJtaTransactionManager.setTransactionManager(TransactionManager)
,
JtaTransactionManager.setTransactionManagerName(java.lang.String)
private void loadWebLogicTransactionHelper() throws TransactionSystemException
TransactionSystemException
private void loadWebLogicTransactionClasses() throws TransactionSystemException
TransactionSystemException
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) throws NotSupportedException, SystemException
JtaTransactionManager
This implementation only supports standard JTA functionality: that is, no per-transaction isolation levels and no transaction names. Can be overridden in subclasses, for specific JTA implementations.
Calls applyIsolationLevel
and applyTimeout
before invoking the UserTransaction's begin
method.
doJtaBegin
in class JtaTransactionManager
txObject
- the JtaTransactionObject containing the UserTransactiondefinition
- TransactionDefinition instance, describing propagation
behavior, isolation level, read-only flag, timeout, and transaction name
NotSupportedException
- if thrown by JTA methods
SystemException
- if thrown by JTA methodsJtaTransactionManager.getUserTransaction()
,
JtaTransactionManager.getTransactionManager()
,
JtaTransactionManager.applyIsolationLevel(org.springframework.transaction.jta.JtaTransactionObject, int)
,
JtaTransactionManager.applyTimeout(org.springframework.transaction.jta.JtaTransactionObject, int)
,
JtaTransactionObject.getUserTransaction()
,
javax.transaction.UserTransaction#setTransactionTimeout
,
javax.transaction.UserTransaction#begin
protected void doJtaResume(JtaTransactionObject txObject, java.lang.Object suspendedTransaction) throws javax.transaction.InvalidTransactionException, SystemException
JtaTransactionManager
Can be overridden in subclasses, for specific JTA implementations.
doJtaResume
in class JtaTransactionManager
txObject
- the JtaTransactionObject containing the UserTransactionsuspendedTransaction
- the suspended JTA Transaction object
javax.transaction.InvalidTransactionException
- if thrown by JTA methods
SystemException
- if thrown by JTA methodsJtaTransactionManager.getTransactionManager()
,
javax.transaction.TransactionManager#resume(javax.transaction.Transaction)
public Transaction createTransaction(java.lang.String name, int timeout) throws NotSupportedException, SystemException
TransactionFactory
createTransaction
in interface TransactionFactory
createTransaction
in class JtaTransactionManager
name
- the transaction name (may be null
)timeout
- the transaction timeout (may be -1 for the default timeout)
null
)
NotSupportedException
- if the transaction manager does not support
a transaction of the specified type
SystemException
- if the transaction manager failed to create the
transaction
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |