Package com.sun.enterprise.transaction
Class TransactionManagerHelper
- java.lang.Object
-
- com.sun.enterprise.transaction.TransactionManagerHelper
-
- All Implemented Interfaces:
TransactionImport
,jakarta.transaction.TransactionManager
@Service @ContractsProvided({TransactionManagerHelper.class,jakarta.transaction.TransactionManager.class}) public class TransactionManagerHelper extends Object implements jakarta.transaction.TransactionManager, TransactionImport
This class is wrapper for the actual transaction manager implementation. JNDI lookup name "java:appserver/TransactionManager" see the com/sun/enterprise/naming/java/javaURLContext.java
-
-
Constructor Summary
Constructors Constructor Description TransactionManagerHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin()
void
commit()
int
getStatus()
jakarta.transaction.Transaction
getTransaction()
int
getTransactionRemainingTimeout()
Return duration before current transaction would timeout.jakarta.resource.spi.XATerminator
getXATerminator()
Provides a handle to aXATerminator
instance.void
postInvokeTx(boolean suspend, boolean checkServletInvocation)
PostInvoke Transaction configuration for Servlet Container.void
preInvokeTx(boolean checkServletInvocation)
PreInvoke Transaction configuration for Servlet Container.void
recreate(Xid xid, long timeout)
Recreate a transaction based on the Xid.void
registerRecoveryResourceHandler(XAResource xaResource)
Allows an arbitrary XAResource to register for recoveryvoid
release(Xid xid)
Release a transaction.void
resume(jakarta.transaction.Transaction tobj)
void
rollback()
void
setRollbackOnly()
void
setTransactionTimeout(int seconds)
jakarta.transaction.Transaction
suspend()
-
-
-
Method Detail
-
begin
public void begin() throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemException
- Specified by:
begin
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.NotSupportedException
jakarta.transaction.SystemException
-
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, jakarta.transaction.SystemException
- Specified by:
commit
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.RollbackException
jakarta.transaction.HeuristicMixedException
jakarta.transaction.HeuristicRollbackException
SecurityException
IllegalStateException
jakarta.transaction.SystemException
-
getStatus
public int getStatus() throws jakarta.transaction.SystemException
- Specified by:
getStatus
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.SystemException
-
getTransaction
public jakarta.transaction.Transaction getTransaction() throws jakarta.transaction.SystemException
- Specified by:
getTransaction
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.SystemException
-
resume
public void resume(jakarta.transaction.Transaction tobj) throws jakarta.transaction.InvalidTransactionException, IllegalStateException, jakarta.transaction.SystemException
- Specified by:
resume
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.InvalidTransactionException
IllegalStateException
jakarta.transaction.SystemException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException
- Specified by:
rollback
in interfacejakarta.transaction.TransactionManager
- Throws:
IllegalStateException
SecurityException
jakarta.transaction.SystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemException
- Specified by:
setRollbackOnly
in interfacejakarta.transaction.TransactionManager
- Throws:
IllegalStateException
jakarta.transaction.SystemException
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws jakarta.transaction.SystemException
- Specified by:
setTransactionTimeout
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.SystemException
-
suspend
public jakarta.transaction.Transaction suspend() throws jakarta.transaction.SystemException
- Specified by:
suspend
in interfacejakarta.transaction.TransactionManager
- Throws:
jakarta.transaction.SystemException
-
recreate
public void recreate(Xid xid, long timeout)
Description copied from interface:TransactionImport
Recreate a transaction based on the Xid. This call causes the calling thread to be associated with the specified transaction.This method imports a transactional context controlled by an external transaction manager.
- Specified by:
recreate
in interfaceTransactionImport
- Parameters:
xid
- the Xid object representing a transaction.
-
release
public void release(Xid xid)
Description copied from interface:TransactionImport
Release a transaction. This call causes the calling thread to be dissociated from the specified transaction.This call releases transactional context imported by recreate method.
- Specified by:
release
in interfaceTransactionImport
- Parameters:
xid
- the Xid object representing a transaction.
-
getXATerminator
public jakarta.resource.spi.XATerminator getXATerminator()
Description copied from interface:TransactionImport
Provides a handle to aXATerminator
instance.The XATerminator exports 2PC protocol control to an external root transaction coordinator.
- Specified by:
getXATerminator
in interfaceTransactionImport
- Returns:
- a
XATerminator
instance.
-
preInvokeTx
public void preInvokeTx(boolean checkServletInvocation)
PreInvoke Transaction configuration for Servlet Container. BaseContainer.preInvokeTx() handles all this for CMT EJB. Compensate that JavaEEInstanceListener.handleBeforeEvent( BEFORE_SERVICE_EVENT) gets called before WSIT WSTX Service pipe associates a JTA txn with incoming thread. Precondition: assumes JTA transaction already associated with current thread.
-
postInvokeTx
public void postInvokeTx(boolean suspend, boolean checkServletInvocation)
PostInvoke Transaction configuration for Servlet Container. BaseContainer.preInvokeTx() handles all this for CMT EJB. Precondition: assumed called prior to current transcation being suspended or released.- Parameters:
suspend
- indicate whether the delisting is due to suspension or transaction completion(commmit/rollback)
-
getTransactionRemainingTimeout
public int getTransactionRemainingTimeout() throws jakarta.transaction.SystemException
Return duration before current transaction would timeout.- Specified by:
getTransactionRemainingTimeout
in interfaceTransactionImport
- Returns:
- Returns the duration in seconds before current transaction would timeout. Returns zero if transaction has no timeout set and returns negative value if transaction already timed out.
- Throws:
IllegalStateException
- Thrown if the current thread is not associated with a transaction.jakarta.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
registerRecoveryResourceHandler
public void registerRecoveryResourceHandler(XAResource xaResource)
Allows an arbitrary XAResource to register for recovery- Specified by:
registerRecoveryResourceHandler
in interfaceTransactionImport
- Parameters:
xaResource
- XAResource to register for recovery
-
-