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 void
addExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)
void
addTxEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)
int
cancelTimerTask()
void
commit()
boolean
delistResource(XAResource xaRes, int flag)
boolean
enlistResource(XAResource xaRes)
boolean
equals(Object other)
Object
getActiveTxCache()
Set
getAllParticipatingPools()
Return all pools registered in the resourceTable.Object
getContainerData()
SimpleResource
getExtendedEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
TransactionalResource
getLAOResource()
TransactionalResource
getNonXAResource()
int
getRemainingTimeout()
Return duration in seconds before transaction would timeout.Set
getResources(Object poolInfo)
long
getStartTime()
int
getStatus()
String
getTransactionId()
SimpleResource
getTxEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
int
hashCode()
boolean
isLocalTx()
boolean
isTimedOut()
protected void
onTxCompletion(boolean status)
void
registerSynchronization(jakarta.transaction.Synchronization sync)
void
removeExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf)
void
rollback()
void
run()
void
setActiveTxCache(Object cache)
void
setContainerData(Object data)
void
setLAOResource(TransactionalResource h)
void
setResources(Set resources, Object poolInfo)
void
setRollbackOnly()
String
toString()
-
-
-
Method Detail
-
getContainerData
public Object getContainerData()
- Specified by:
getContainerData
in interfaceJavaEETransaction
-
setContainerData
public void setContainerData(Object data)
- Specified by:
setContainerData
in interfaceJavaEETransaction
-
cancelTimerTask
public int cancelTimerTask()
-
isTimedOut
public boolean isTimedOut()
- Specified by:
isTimedOut
in interfaceJavaEETransaction
-
getNonXAResource
public TransactionalResource getNonXAResource()
- Specified by:
getNonXAResource
in interfaceJavaEETransaction
-
getLAOResource
public TransactionalResource getLAOResource()
- Specified by:
getLAOResource
in interfaceJavaEETransaction
-
setLAOResource
public void setLAOResource(TransactionalResource h)
- Specified by:
setLAOResource
in interfaceJavaEETransaction
-
addTxEntityManagerMapping
public void addTxEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)
- Specified by:
addTxEntityManagerMapping
in interfaceJavaEETransaction
-
getTxEntityManagerResource
public SimpleResource getTxEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
getTxEntityManagerResource
in interfaceJavaEETransaction
-
onTxCompletion
protected void onTxCompletion(boolean status)
-
addExtendedEntityManagerMapping
public void addExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf, SimpleResource em)
- Specified by:
addExtendedEntityManagerMapping
in interfaceJavaEETransaction
-
removeExtendedEntityManagerMapping
public void removeExtendedEntityManagerMapping(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
removeExtendedEntityManagerMapping
in interfaceJavaEETransaction
-
getExtendedEntityManagerResource
public SimpleResource getExtendedEntityManagerResource(jakarta.persistence.EntityManagerFactory emf)
- Specified by:
getExtendedEntityManagerResource
in interfaceJavaEETransaction
-
isLocalTx
public boolean isLocalTx()
- Specified by:
isLocalTx
in interfaceJavaEETransaction
-
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.Transaction
- Throws:
jakarta.transaction.RollbackException
jakarta.transaction.HeuristicMixedException
jakarta.transaction.HeuristicRollbackException
SecurityException
IllegalStateException
jakarta.transaction.SystemException
-
rollback
public void rollback() throws IllegalStateException, jakarta.transaction.SystemException
- Specified by:
rollback
in interfacejakarta.transaction.Transaction
- Throws:
IllegalStateException
jakarta.transaction.SystemException
-
delistResource
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, jakarta.transaction.SystemException
- Specified by:
delistResource
in interfacejakarta.transaction.Transaction
- Throws:
IllegalStateException
jakarta.transaction.SystemException
-
enlistResource
public boolean enlistResource(XAResource xaRes) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
- Specified by:
enlistResource
in interfacejakarta.transaction.Transaction
- Throws:
jakarta.transaction.RollbackException
IllegalStateException
jakarta.transaction.SystemException
-
getStatus
public int getStatus() throws jakarta.transaction.SystemException
- Specified by:
getStatus
in 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:
registerSynchronization
in interfacejakarta.transaction.Transaction
- Throws:
jakarta.transaction.RollbackException
IllegalStateException
jakarta.transaction.SystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemException
- Specified by:
setRollbackOnly
in interfacejakarta.transaction.Transaction
- Throws:
IllegalStateException
jakarta.transaction.SystemException
-
getTransactionId
public String getTransactionId()
-
getStartTime
public long getStartTime()
-
setResources
public void setResources(Set resources, Object poolInfo)
- Specified by:
setResources
in interfaceJavaEETransaction
-
getResources
public Set getResources(Object poolInfo)
- Specified by:
getResources
in 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:
getAllParticipatingPools
in 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.
-
-