Package com.sun.enterprise.transaction
Class JavaEETransactionImpl
- java.lang.Object
-
- com.sun.enterprise.transaction.JavaEETransactionImpl
-
- All Implemented Interfaces:
JavaEETransaction,jakarta.transaction.Transaction,Runnable
public final class JavaEETransactionImpl extends Object implements Runnable, JavaEETransaction
This class implements the JTA Transaction API for the J2EE RI. It is a wrapper over the JTS Transaction object that provides optimized local transaction support when a transaction uses zero/one non-XA resource, and delegates to JTS otherwise. This object can be in two states: local tx (jtsTx==null) or global (JTS) tx. If jtsTx!=null, all calls are delegated to jtsTx. Time out capability is added to the local transactions. This class extends the TimerTask. When the transaction needs to be timedout, this schedules with the timer. At the commit and rollback time, task will be cancelled. If the transaction is timedout, run() method will be called and transaction will be marked for rollback.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)voidaddTxEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)intcancelTimerTask()voidcommit()booleandelistResource(XAResource xaRes, int flag)booleanenlistResource(XAResource xaRes)booleanequals(Object other)ObjectgetActiveTxCache()SetgetAllParticipatingPools()Return all pools registered in the resourceTable.ObjectgetContainerData()SimpleResourcegetExtendedEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)TransactionalResourcegetLAOResource()TransactionalResourcegetNonXAResource()intgetRemainingTimeout()Return duration in seconds before transaction would timeout.SetgetResources(Object poolInfo)longgetStartTime()intgetStatus()StringgetTransactionId()SimpleResourcegetTxEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)inthashCode()booleanisLocalTx()booleanisTimedOut()protected voidonTxCompletion(boolean status)voidregisterSynchronization(jakarta.transaction.Synchronization sync)voidremoveExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf)voidrollback()voidrun()voidsetActiveTxCache(Object cache)voidsetContainerData(Object data)voidsetLAOResource(TransactionalResource h)voidsetResources(Set resources, Object poolInfo)voidsetRollbackOnly()StringtoString()
-
-
-
Method Detail
-
getContainerData
public Object getContainerData()
- Specified by:
getContainerDatain interfaceJavaEETransaction
-
setContainerData
public void setContainerData(Object data)
- Specified by:
setContainerDatain interfaceJavaEETransaction
-
cancelTimerTask
public int cancelTimerTask()
-
isTimedOut
public boolean isTimedOut()
- Specified by:
isTimedOutin interfaceJavaEETransaction
-
getNonXAResource
public TransactionalResource getNonXAResource()
- Specified by:
getNonXAResourcein interfaceJavaEETransaction
-
getLAOResource
public TransactionalResource getLAOResource()
- Specified by:
getLAOResourcein interfaceJavaEETransaction
-
setLAOResource
public void setLAOResource(TransactionalResource h)
- Specified by:
setLAOResourcein interfaceJavaEETransaction
-
addTxEntityManagerMapping
public void addTxEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)- Specified by:
addTxEntityManagerMappingin interfaceJavaEETransaction
-
getTxEntityManagerResource
public SimpleResource getTxEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
getTxEntityManagerResourcein interfaceJavaEETransaction
-
onTxCompletion
protected void onTxCompletion(boolean status)
-
addExtendedEntityManagerMapping
public void addExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)- Specified by:
addExtendedEntityManagerMappingin interfaceJavaEETransaction
-
removeExtendedEntityManagerMapping
public void removeExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
removeExtendedEntityManagerMappingin interfaceJavaEETransaction
-
getExtendedEntityManagerResource
public SimpleResource getExtendedEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
getExtendedEntityManagerResourcein interfaceJavaEETransaction
-
isLocalTx
public boolean isLocalTx()
- Specified by:
isLocalTxin interfaceJavaEETransaction
-
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, jakarta.transaction.SystemException- Specified by:
commitin interfacejakarta.transaction.Transaction- Throws:
jakarta.transaction.RollbackExceptionjakarta.transaction.HeuristicMixedExceptionjakarta.transaction.HeuristicRollbackExceptionSecurityExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
rollback
public void rollback() throws IllegalStateException, jakarta.transaction.SystemException- Specified by:
rollbackin interfacejakarta.transaction.Transaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
delistResource
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, jakarta.transaction.SystemException
- Specified by:
delistResourcein interfacejakarta.transaction.Transaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
enlistResource
public boolean enlistResource(XAResource xaRes) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
- Specified by:
enlistResourcein interfacejakarta.transaction.Transaction- Throws:
jakarta.transaction.RollbackExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
getStatus
public int getStatus() throws jakarta.transaction.SystemException- Specified by:
getStatusin interfacejakarta.transaction.Transaction- Throws:
jakarta.transaction.SystemException
-
registerSynchronization
public void registerSynchronization(jakarta.transaction.Synchronization sync) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException- Specified by:
registerSynchronizationin interfacejakarta.transaction.Transaction- Throws:
jakarta.transaction.RollbackExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemException- Specified by:
setRollbackOnlyin interfacejakarta.transaction.Transaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
getTransactionId
public String getTransactionId()
-
getStartTime
public long getStartTime()
-
setResources
public void setResources(Set resources, Object poolInfo)
- Specified by:
setResourcesin interfaceJavaEETransaction
-
getResources
public Set getResources(Object poolInfo)
- Specified by:
getResourcesin interfaceJavaEETransaction
-
getAllParticipatingPools
public Set getAllParticipatingPools()
Return all pools registered in the resourceTable. This will cut down the scope of pools on which transactionComplted is called by the PoolManagerImpl. This method will return only those pools that have ever participated in a tx- Specified by:
getAllParticipatingPoolsin interfaceJavaEETransaction
-
setActiveTxCache
public void setActiveTxCache(Object cache)
-
getActiveTxCache
public Object getActiveTxCache()
-
getRemainingTimeout
public int getRemainingTimeout()
Return duration in seconds before transaction would timeout. Returns zero if this transaction has no timeout set. Returns negative value if already timed out.
-
-