类 WebLogicJtaTransactionManager
- java.lang.Object
- org.springframework.transaction.support.AbstractPlatformTransactionManager
- org.springframework.transaction.jta.JtaTransactionManager
- org.springframework.transaction.jta.WebLogicJtaTransactionManager
public class WebLogicJtaTransactionManager extends JtaTransactionManager
SpecialJtaTransactionManager
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.NOTE: This JtaTransactionManager is intended to refine specific transaction demarcation behavior on Spring's side. It will happily co-exist with independently configured WebLogic transaction strategies in your persistence provider, with no need to specifically connect those setups in any way.
- 从以下版本开始:
- 1.1
- 作者:
- Juergen Hoeller
- 另请参阅:
TransactionDefinition.getName()
,TransactionDefinition.getIsolationLevel()
,weblogic.transaction.UserTransaction#begin(String)
,weblogic.transaction.Transaction#setProperty
,weblogic.transaction.TransactionManager#forceResume
,weblogic.transaction.TransactionHelper
, 序列化表格
嵌套类概要
从类继承的嵌套类/接口 org.springframework.transaction.support.AbstractPlatformTransactionManager
AbstractPlatformTransactionManager.SuspendedResourcesHolder
字段概要
从类继承的字段 org.springframework.transaction.jta.JtaTransactionManager
DEFAULT_TRANSACTION_SYNCHRONIZATION_REGISTRY_NAME, DEFAULT_USER_TRANSACTION_NAME, FALLBACK_TRANSACTION_MANAGER_NAMES
从类继承的字段 org.springframework.transaction.support.AbstractPlatformTransactionManager
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
构造器概要
构造器 构造器 说明 WebLogicJtaTransactionManager()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Initialize the UserTransaction as well as the TransactionManager handle.Transaction
createTransaction(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, Object suspendedTransaction)
Perform a JTA resume on the JTA TransactionManager.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.从类继承的方法 org.springframework.transaction.jta.JtaTransactionManager
applyIsolationLevel, applyTimeout, buildUserTransaction, checkUserTransactionAndTransactionManager, doBegin, doCleanupAfterCompletion, doCommit, doGetJtaTransaction, doGetTransaction, doJtaSuspend, doRegisterAfterCompletionWithJtaTransaction, doResume, doRollback, doSetRollbackOnly, doSuspend, findTransactionManager, findTransactionSynchronizationRegistry, findUserTransaction, getJndiEnvironment, getJndiTemplate, getTransactionManager, getTransactionSynchronizationRegistry, getUserTransaction, initTransactionSynchronizationRegistry, initUserTransactionAndTransactionManager, isExistingTransaction, lookupTransactionManager, lookupTransactionSynchronizationRegistry, lookupUserTransaction, registerAfterCompletionWithExistingTransaction, retrieveTransactionSynchronizationRegistry, setAllowCustomIsolationLevels, setAutodetectTransactionManager, setAutodetectTransactionSynchronizationRegistry, setAutodetectUserTransaction, setCacheUserTransaction, setJndiEnvironment, setJndiTemplate, setTransactionManager, setTransactionManagerName, setTransactionSynchronizationRegistry, setTransactionSynchronizationRegistryName, setUserTransaction, setUserTransactionName, shouldCommitOnGlobalRollbackOnly, supportsResourceAdapterManagedTransactions, useSavepointForNestedTransaction
从类继承的方法 org.springframework.transaction.support.AbstractPlatformTransactionManager
commit, determineTimeout, getDefaultTimeout, getTransaction, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, newTransactionStatus, prepareForCommit, prepareSynchronization, prepareTransactionStatus, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, suspend, triggerBeforeCommit, triggerBeforeCompletion
构造器详细资料
WebLogicJtaTransactionManager
public WebLogicJtaTransactionManager()
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws TransactionSystemException
从类复制的说明:JtaTransactionManager
Initialize the UserTransaction as well as the TransactionManager handle.
retrieveUserTransaction
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException
从类复制的说明:JtaTransactionManager
Allows subclasses to retrieve the JTA UserTransaction in a vendor-specific manner. Only called if no "userTransaction" or "userTransactionName" specified.The default implementation simply returns
null
.- 覆盖:
retrieveUserTransaction
在类中JtaTransactionManager
- 返回:
- the JTA UserTransaction handle to use, or
null
if none found - 抛出:
TransactionSystemException
- in case of errors- 另请参阅:
JtaTransactionManager.setUserTransaction(javax.transaction.UserTransaction)
,JtaTransactionManager.setUserTransactionName(java.lang.String)
retrieveTransactionManager
protected TransactionManager retrieveTransactionManager() throws TransactionSystemException
从类复制的说明:JtaTransactionManager
Allows subclasses to retrieve the JTA TransactionManager in a vendor-specific manner. Only called if no "transactionManager" or "transactionManagerName" specified.The default implementation simply returns
null
.- 覆盖:
retrieveTransactionManager
在类中JtaTransactionManager
- 返回:
- the JTA TransactionManager handle to use, or
null
if none found - 抛出:
TransactionSystemException
- in case of errors- 另请参阅:
JtaTransactionManager.setTransactionManager(javax.transaction.TransactionManager)
,JtaTransactionManager.setTransactionManagerName(java.lang.String)
doJtaBegin
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) throws NotSupportedException, SystemException
从类复制的说明:JtaTransactionManager
Perform a JTA begin on the JTA UserTransaction or TransactionManager.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
andapplyTimeout
before invoking the UserTransaction'sbegin
method.- 覆盖:
doJtaBegin
在类中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 methodsSystemException
- if thrown by JTA methods- 另请参阅:
JtaTransactionManager.getUserTransaction()
,JtaTransactionManager.getTransactionManager()
,JtaTransactionManager.applyIsolationLevel(org.springframework.transaction.jta.JtaTransactionObject, int)
,JtaTransactionManager.applyTimeout(org.springframework.transaction.jta.JtaTransactionObject, int)
,JtaTransactionObject.getUserTransaction()
,UserTransaction.setTransactionTimeout(int)
,UserTransaction.begin()
doJtaResume
protected void doJtaResume(JtaTransactionObject txObject, Object suspendedTransaction) throws InvalidTransactionException, SystemException
从类复制的说明:JtaTransactionManager
Perform a JTA resume on the JTA TransactionManager.Can be overridden in subclasses, for specific JTA implementations.
- 覆盖:
doJtaResume
在类中JtaTransactionManager
- 参数:
txObject
- the JtaTransactionObject containing the UserTransactionsuspendedTransaction
- the suspended JTA Transaction object- 抛出:
InvalidTransactionException
- if thrown by JTA methodsSystemException
- if thrown by JTA methods- 另请参阅:
JtaTransactionManager.getTransactionManager()
,TransactionManager.resume(javax.transaction.Transaction)
createTransaction
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException
从接口复制的说明:TransactionFactory
Create an active Transaction object based on the given name and timeout.- 指定者:
createTransaction
在接口中TransactionFactory
- 覆盖:
createTransaction
在类中JtaTransactionManager
- 参数:
name
- the transaction name (may benull
)timeout
- the transaction timeout (may be -1 for the default timeout)- 返回:
- the active Transaction object (never
null
) - 抛出:
NotSupportedException
- if the transaction manager does not support a transaction of the specified typeSystemException
- if the transaction manager failed to create the transaction