public class TransactionManagerImpl extends Object implements TransactionManager, UserTransaction, TransactionSynchronizationRegistry, XidImporter, MonitorableTransactionManager, RecoverableTransactionManager
| Constructor and Description |
|---|
TransactionManagerImpl() |
TransactionManagerImpl(int defaultTransactionTimeoutSeconds) |
TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
TransactionLog transactionLog) |
TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
XidFactory xidFactory,
TransactionLog transactionLog) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTransactionAssociationListener(TransactionManagerMonitor listener) |
void |
begin()
Create a new transaction and associate it with the current thread.
|
Transaction |
begin(long transactionTimeoutMilliseconds) |
void |
commit()
Complete the transaction associated with the current thread.
|
void |
commit(Transaction tx,
boolean onePhase) |
void |
forget(Transaction tx) |
long |
getActiveCount()
Returns the number of active transactions.
|
Map<Xid,TransactionImpl> |
getExternalXids() |
Object |
getResource(Object key)
Get an object from the Map of resources being managed for
the transaction bound to the current thread at the time this
method is called.
|
boolean |
getRollbackOnly()
Get the rollbackOnly status of the transaction bound to the
current thread at the time this method is called.
|
int |
getStatus()
Obtain the status of the transaction associated with the current thread.
|
long |
getTotalCommits()
Return the number of total commits
|
long |
getTotalRollbacks()
Returns the number of total rollbacks
|
Transaction |
getTransaction()
Get the transaction object that represents the transaction
context of the calling thread.
|
Object |
getTransactionKey()
Return an opaque object to represent the transaction bound to the
current thread at the time this method is called.
|
int |
getTransactionStatus()
Return the status of the transaction bound to the
current thread at the time this method is called.
|
Transaction |
importXid(Xid xid,
long transactionTimeoutMilliseconds) |
int |
prepare(Transaction tx) |
void |
putResource(Object key,
Object value)
Add or replace an object in the Map of resources being managed for
the transaction bound to the current thread at the time this
method is called.
|
void |
recoveryError(Exception e) |
void |
registerInterposedSynchronization(Synchronization synchronization)
jta 1.1 method so the jpa implementations can be told to flush their caches.
|
void |
registerNamedXAResourceFactory(NamedXAResourceFactory namedXAResourceFactory) |
void |
removeTransactionAssociationListener(TransactionManagerMonitor listener) |
void |
resetStatistics()
Reset statistics
|
void |
resume(Transaction tx)
Resume the transaction context association of the calling thread
with the transaction represented by the supplied Transaction object.
|
void |
rollback()
Roll back the transaction associated with the current thread.
|
void |
rollback(Transaction tx) |
void |
setRollbackOnly()
Modify the transaction associated with the current thread such that
the only possible outcome of the transaction is to roll back the
transaction.
|
void |
setTransactionTimeout(int seconds)
Modify the timeout value that is associated with transactions started
by the current thread with the begin method.
|
Transaction |
suspend()
Suspend the transaction currently associated with the calling
thread and return a Transaction object that represents the
transaction context being suspended.
|
void |
unregisterNamedXAResourceFactory(String namedXAResourceFactoryName) |
public TransactionManagerImpl()
throws XAException
XAExceptionpublic TransactionManagerImpl(int defaultTransactionTimeoutSeconds)
throws XAException
XAExceptionpublic TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
TransactionLog transactionLog)
throws XAException
XAExceptionpublic TransactionManagerImpl(int defaultTransactionTimeoutSeconds,
XidFactory xidFactory,
TransactionLog transactionLog)
throws XAException
XAExceptionpublic Transaction getTransaction()
javax.transaction.TransactionManagergetTransaction in interface TransactionManagerTransaction object representing the
transaction associated with the calling thread.public void setTransactionTimeout(int seconds)
throws SystemException
javax.transaction.TransactionManagerIf an application has not called this method, the transaction service uses some default value for the transaction timeout.
setTransactionTimeout in interface TransactionManagersetTransactionTimeout in interface UserTransactionseconds - The value of the timeout in seconds. If the value is zero,
the transaction service restores the default value. If the value
is negative a SystemException is thrown.SystemException - Thrown if the transaction manager
encounters an unexpected error condition.public int getStatus()
throws SystemException
javax.transaction.TransactionManagergetStatus in interface TransactionManagergetStatus in interface UserTransactionSystemException - Thrown if the transaction manager
encounters an unexpected error condition.public void begin()
throws NotSupportedException,
SystemException
javax.transaction.TransactionManagerbegin in interface TransactionManagerbegin in interface UserTransactionNotSupportedException - Thrown if the thread is already
associated with a transaction and the Transaction Manager
implementation does not support nested transactions.SystemException - Thrown if the transaction manager
encounters an unexpected error condition.public Transaction begin(long transactionTimeoutMilliseconds) throws NotSupportedException, SystemException
NotSupportedExceptionSystemExceptionpublic Transaction suspend() throws SystemException
javax.transaction.TransactionManagersuspend in interface TransactionManagerSystemException - Thrown if the transaction manager
encounters an unexpected error condition.public void resume(Transaction tx) throws IllegalStateException, InvalidTransactionException, SystemException
javax.transaction.TransactionManagerresume in interface TransactionManagertx - The Transaction object that represents the
transaction to be resumed.IllegalStateException - Thrown if the thread is already
associated with another transaction.InvalidTransactionException - Thrown if the parameter
transaction object contains an invalid transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition.public Object getResource(Object key)
javax.transaction.TransactionSynchronizationRegistryMap.get(Object) for a Map that
supports non-null keys and null values. For example,
the returned value is null if there is no entry for the parameter
key or if the value associated with the key is actually null.getResource in interface TransactionSynchronizationRegistrykey - the key for the Map entry.public boolean getRollbackOnly()
javax.transaction.TransactionSynchronizationRegistrygetRollbackOnly in interface TransactionSynchronizationRegistrypublic Object getTransactionKey()
javax.transaction.TransactionSynchronizationRegistryThis object will return the same hashCode and compare equal to all other objects returned by calling this method from any component executing in the same transaction context in the same application server.
The toString method returns a String that might be usable by a human reader to usefully understand the transaction context. The toString result is otherwise not defined. Specifically, there is no forward or backward compatibility guarantee of the results of toString.
The object is not necessarily serializable, and has no defined behavior outside the virtual machine whence it was obtained.
getTransactionKey in interface TransactionSynchronizationRegistrypublic int getTransactionStatus()
javax.transaction.TransactionSynchronizationRegistrygetTransactionStatus in interface TransactionSynchronizationRegistrypublic void putResource(Object key, Object value)
javax.transaction.TransactionSynchronizationRegistryMap.put(Object, Object) for a Map that
supports non-null keys and null values. For example,
if there is already an value associated with the key, it is replaced
by the value parameter.putResource in interface TransactionSynchronizationRegistrykey - the key for the Map entry.value - the value for the Map entry.public void registerInterposedSynchronization(Synchronization synchronization)
registerInterposedSynchronization in interface TransactionSynchronizationRegistrysynchronization - interposed synchronizationpublic void setRollbackOnly()
throws IllegalStateException
javax.transaction.TransactionManagersetRollbackOnly in interface TransactionManagersetRollbackOnly in interface TransactionSynchronizationRegistrysetRollbackOnly in interface UserTransactionIllegalStateException - Thrown if the current thread is
not associated with a transaction.public void commit()
throws HeuristicMixedException,
HeuristicRollbackException,
IllegalStateException,
RollbackException,
SecurityException,
SystemException
javax.transaction.TransactionManagercommit in interface TransactionManagercommit in interface UserTransactionHeuristicMixedException - Thrown to indicate that a heuristic
decision was made and that some relevant updates have been committed
while others have been rolled back.HeuristicRollbackException - Thrown to indicate that a
heuristic decision was made and that all relevant updates have been
rolled back.IllegalStateException - Thrown if the current thread is
not associated with a transaction.RollbackException - Thrown to indicate that
the transaction has been rolled back rather than committed.SecurityException - Thrown to indicate that the thread is
not allowed to commit the transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition.public void rollback()
throws IllegalStateException,
SecurityException,
SystemException
javax.transaction.TransactionManagerrollback in interface TransactionManagerrollback in interface UserTransactionIllegalStateException - Thrown if the current thread is
not associated with a transaction.SecurityException - Thrown to indicate that the thread is
not allowed to roll back the transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition.public Transaction importXid(Xid xid, long transactionTimeoutMilliseconds) throws XAException, SystemException
importXid in interface XidImporterXAExceptionSystemExceptionpublic void commit(Transaction tx, boolean onePhase) throws XAException
commit in interface XidImporterXAExceptionpublic void forget(Transaction tx) throws XAException
forget in interface XidImporterXAExceptionpublic int prepare(Transaction tx) throws XAException
prepare in interface XidImporterXAExceptionpublic void rollback(Transaction tx) throws XAException
rollback in interface XidImporterXAExceptionpublic void recoveryError(Exception e)
recoveryError in interface RecoverableTransactionManagerpublic void registerNamedXAResourceFactory(NamedXAResourceFactory namedXAResourceFactory)
registerNamedXAResourceFactory in interface RecoverableTransactionManagerpublic void unregisterNamedXAResourceFactory(String namedXAResourceFactoryName)
unregisterNamedXAResourceFactory in interface RecoverableTransactionManagerpublic Map<Xid,TransactionImpl> getExternalXids()
getExternalXids in interface XidImporterpublic void addTransactionAssociationListener(TransactionManagerMonitor listener)
addTransactionAssociationListener in interface MonitorableTransactionManagerpublic void removeTransactionAssociationListener(TransactionManagerMonitor listener)
removeTransactionAssociationListener in interface MonitorableTransactionManagerpublic long getActiveCount()
public long getTotalCommits()
public long getTotalRollbacks()
public void resetStatistics()
Copyright © 2010 - 2020 Adobe. All Rights Reserved