public class TransactionManagerImpl extends Object implements TransactionManager
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Create a new transaction and associate it with the current thread.
|
void |
begin(int timeout)
Create a new transaction with the given timeout and associate it
with the current thread.
|
void |
commit()
Complete the transaction associated with the current thread.
|
int |
getStatus()
Obtain the status of the transaction associated with the current thread.
|
Transaction |
getTransaction()
Get the transaction object that represents the transaction
context of the calling thread
|
static TransactionManagerImpl |
getTransactionManagerImpl()
get the singleton TransactionManagerImpl
|
static int |
getXAResourceTimeOut() |
static javax.resource.spi.XATerminator |
getXATerminator()
Provides a handle to a
XATerminator instance. |
static void |
initJTSProperties(Properties props,
String logDir,
boolean trace,
String traceDir)
extends props with the JTS-related properties
based on the specified parameters.
|
static int |
mapStatus(org.omg.CosTransactions.Status status)
given a CosTransactions Status, return
the equivalent JTA Status
|
static void |
recover(Enumeration xaResourceList)
The application server passes in the list of XAResource objects
to be recovered.
|
static void |
recreate(Xid xid,
long timeout)
Recreate a transaction based on the Xid.
|
static void |
release(Xid xid)
Release a transaction.
|
void |
resume(Transaction suspended)
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 |
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 subsequent invocations of the begin method.
|
static void |
setXAResourceTimeOut(int value)
used to set XAResource timeout
|
Transaction |
suspend()
Suspend the transaction currently associated with the calling
thread and return a Transaction object that represents the
transaction context being suspended.
|
public static TransactionManagerImpl getTransactionManagerImpl()
public static void initJTSProperties(Properties props, String logDir, boolean trace, String traceDir)
prop - the properties that will be extendedlogDir - directory for the log, current directory if nulltrace - enable JTS tracingtraceDir - directory for tracing, current directory if nullpublic static int mapStatus(org.omg.CosTransactions.Status status)
public void begin()
throws NotSupportedException,
SystemException
begin in interface TransactionManagerNotSupportedException - Thrown if the thread is already
associated with a transaction.SystemExceptionpublic void begin(int timeout)
throws NotSupportedException,
SystemException
NotSupportedException - Thrown if the thread is already
associated with a transaction.SystemExceptionpublic void commit()
throws RollbackException,
HeuristicMixedException,
HeuristicRollbackException,
SecurityException,
IllegalStateException,
SystemException
commit in interface TransactionManagerRollbackException - Thrown to indicate that
the transaction has been rolled back rather than committed.HeuristicMixedException - 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.SecurityException - Thrown to indicate that the thread is
not allowed to commit the transaction.IllegalStateException - Thrown if the current thread is
not associated with a transaction.SystemExceptionpublic void rollback()
throws IllegalStateException,
SecurityException,
SystemException
rollback in interface TransactionManagerSecurityException - Thrown to indicate that the thread is
not allowed to roll back the transaction.IllegalStateException - Thrown if the current thread is
not associated with a transaction.SystemExceptionpublic void setRollbackOnly()
throws IllegalStateException,
SystemException
setRollbackOnly in interface TransactionManagerIllegalStateException - Thrown if the current thread is
not associated with a transaction.SystemExceptionpublic int getStatus()
throws SystemException
getStatus in interface TransactionManagerSystemExceptionpublic void setTransactionTimeout(int seconds)
throws SystemException
If an application has not called this method, the transaction service uses some default value for the transaction timeout.
setTransactionTimeout in interface TransactionManagerseconds - 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 Transaction getTransaction() throws SystemException
getTransaction in interface TransactionManagerSystemExceptionpublic void resume(Transaction suspended) throws InvalidTransactionException, IllegalStateException, SystemException
resume in interface TransactionManagerInvalidTransactionExceptionIllegalStateExceptionSystemExceptionpublic Transaction suspend() throws SystemException
suspend in interface TransactionManagerSystemExceptionpublic static void recover(Enumeration xaResourceList)
xaResourceList - list of XAResource objects.public static void recreate(Xid xid, long timeout) throws javax.resource.spi.work.WorkException
xid - the Xid object representing a transaction.timeout - positive, non-zero value for transaction timeout.javax.resource.spi.work.WorkExceptionpublic static void release(Xid xid) throws javax.resource.spi.work.WorkException
xid - the Xid object representing a transaction.javax.resource.spi.work.WorkExceptionpublic static javax.resource.spi.XATerminator getXATerminator()
XATerminator instance. The
XATerminator instance could be used by a resource adapter
to flow-in transaction completion and crash recovery calls from an EIS.XATerminator instance.public static void setXAResourceTimeOut(int value)
public static int getXAResourceTimeOut()
Copyright © 2017. All rights reserved.