Class TransactionImple
java.lang.Object
com.arjuna.ats.internal.jta.transaction.jts.TransactionImple
- All Implemented Interfaces:
Transaction
,jakarta.transaction.Transaction
- Direct Known Subclasses:
TransactionImple
public class TransactionImple
extends Object
implements jakarta.transaction.Transaction, Transaction
An implementation of jakarta.transaction.Transaction.
- Since:
- JTS 1.2.4.
- Version:
- $Id: TransactionImple.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark_little@hp.com)
-
Field Summary
Fields inherited from interface com.arjuna.ats.jta.transaction.Transaction
XACONNECTION, XAMODIFIER
-
Constructor Summary
ModifierConstructorDescriptionprotected
-
Method Summary
Modifier and TypeMethodDescriptionprotected Xid
baseXid()
If this is an imported JCA transaction, then this method will return the Xid we should pretend to be.void
commit()
We will never throw a HeuristicRollbackException because if we get a HeuristicRollback from a resource, and can successfully rollback the other resources, this is then the same as having simply been forced to rollback the transaction during phase 1.protected void
boolean
delistResource
(XAResource xaRes, int flags) void
endAssociation
(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) protected boolean
If there are any suspended RMs then we should call end on them before the transaction is terminated.boolean
enlistResource
(XAResource xaRes) boolean
enlistResource
(XAResource xaRes, Object[] params) boolean
Overloads Object.equals()final Uid
get_uid()
com.arjuna.ats.internal.jts.ControlWrapper
long
int
int
static final TransactionImple
Creates if does not exist and adds to our internal mapping table.static final TransactionImple
getTransaction
(Uid id) final Xid
getTxId()
getTxLocalResource
(Object key) int
getXAResourceState
(XAResource xaRes) int
hashCode()
TransactionImple (which could be a proxy to the remote transaction) will return up to two different hashCodes.boolean
isAlive()
protected static final void
void
putTxLocalResource
(Object key, Object value) void
registerSynchronization
(jakarta.transaction.Synchronization sync) static final void
void
rollback()
protected void
void
void
setXAResourceState
(XAResource xaRes, int state) final void
shutdown()
toString()
-
Field Details
-
_theTransaction
-
-
Constructor Details
-
TransactionImple
- Throws:
SubtransactionsUnavailable
-
TransactionImple
-
-
Method Details
-
equals
Overloads Object.equals() -
hashCode
public int hashCode()TransactionImple (which could be a proxy to the remote transaction) will return up to two different hashCodes. It will return a valid hashcode if the remote transaction is active and it will return -1 if the transaction is no longer active. The hashcode is the uid of the transaction, when the transaction completes it no longer has a uid in theory hence the -1. With raw JTA as we don't reset the uid when the transaction completes it will still get a hashcode based off the uid. Return -1 if we fail. -
getControlWrapper
public com.arjuna.ats.internal.jts.ControlWrapper getControlWrapper() -
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException, IllegalStateExceptionWe will never throw a HeuristicRollbackException because if we get a HeuristicRollback from a resource, and can successfully rollback the other resources, this is then the same as having simply been forced to rollback the transaction during phase 1. The OTS interfaces do not allow a differentiation.- Specified by:
commit
in interfacejakarta.transaction.Transaction
- Throws:
jakarta.transaction.RollbackException
jakarta.transaction.HeuristicMixedException
jakarta.transaction.HeuristicRollbackException
SecurityException
jakarta.transaction.SystemException
IllegalStateException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException- Specified by:
rollback
in interfacejakarta.transaction.Transaction
- Throws:
IllegalStateException
SecurityException
jakarta.transaction.SystemException
-
setRollbackOnly
- Specified by:
setRollbackOnly
in interfacejakarta.transaction.Transaction
- Throws:
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
-
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
-
enlistResource
public boolean enlistResource(XAResource xaRes, Object[] params) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException - Specified by:
enlistResource
in interfaceTransaction
- Throws:
jakarta.transaction.RollbackException
IllegalStateException
jakarta.transaction.SystemException
-
delistResource
public boolean delistResource(XAResource xaRes, int flags) throws IllegalStateException, jakarta.transaction.SystemException - Specified by:
delistResource
in interfacejakarta.transaction.Transaction
- Throws:
IllegalStateException
jakarta.transaction.SystemException
-
get_uid
- Specified by:
get_uid
in interfaceTransaction
-
getTxId
- Specified by:
getTxId
in interfaceTransaction
-
toString
-
endAssociation
public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException - Throws:
XAException
-
getXAResourceState
- Specified by:
getXAResourceState
in interfaceTransaction
-
setXAResourceState
-
getTransaction
Creates if does not exist and adds to our internal mapping table. -
getTransaction
-
shutdown
public final void shutdown() -
getTxLocalResource
- Specified by:
getTxLocalResource
in interfaceTransaction
-
putTxLocalResource
- Specified by:
putTxLocalResource
in interfaceTransaction
-
isAlive
public boolean isAlive()- Specified by:
isAlive
in interfaceTransaction
-
commitAndDisassociate
protected void commitAndDisassociate() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException, IllegalStateException- Throws:
jakarta.transaction.RollbackException
jakarta.transaction.HeuristicMixedException
jakarta.transaction.HeuristicRollbackException
SecurityException
jakarta.transaction.SystemException
IllegalStateException
-
rollbackAndDisassociate
protected void rollbackAndDisassociate() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException- Throws:
IllegalStateException
SecurityException
jakarta.transaction.SystemException
-
baseXid
If this is an imported JCA transaction, then this method will return the Xid we should pretend to be. Otherwise it'll return null and we will generate our own Xid.- Returns:
- null for a pure ATS transaction, otherwise a valid JCA imported Xid.
-
putTransaction
-
removeTransaction
-
endSuspendedRMs
protected boolean endSuspendedRMs()If there are any suspended RMs then we should call end on them before the transaction is terminated. -
getTransactions
-
getResources
- Specified by:
getResources
in interfaceTransaction
-
getTimeout
public int getTimeout()- Specified by:
getTimeout
in interfaceTransaction
-
getRemainingTimeoutMills
public long getRemainingTimeoutMills()- Specified by:
getRemainingTimeoutMills
in interfaceTransaction
-
getSynchronizations
- Specified by:
getSynchronizations
in interfaceTransaction
-