Package com.arjuna.ats.jts.extensions
Class AtomicTransaction
java.lang.Object
com.arjuna.ats.jts.extensions.AtomicTransaction
- Direct Known Subclasses:
AtomicTransaction
,TopLevelTransaction
Similar to CosTransactions::Current. However, this class does transaction
scoping, so if an instance is garbage collected and the transaction is still
running, it will be rolled back automatically. It also adds some convenience
routines which Current does not do.
- Since:
- JTS 1.0.
- Version:
- $Id: AtomicTransaction.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark_little@hp.com)
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.arjuna.ats.internal.jts.ControlWrapper
protected Status
protected int
static final int
static final int
The types of transactions which can be created. -
Constructor Summary
ModifierConstructorDescriptionCreate a new transaction.protected
AtomicTransaction
(com.arjuna.ats.internal.jts.ControlWrapper tx) -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
Start the transaction.void
commit
(boolean report_heuristics) control()
boolean
void
finalize()
int
get_uid()
protected final Status
int
int
hashCode()
Register the specified resource with this transaction.void
Register the specified subtransaction aware resource with this transaction.void
Register the specified synchronization with this transaction.void
resume()
Resume this transaction.void
rollback()
void
Allow action commit to be supressed.void
set_timeout
(int seconds) Set the transaction timeout.void
suspend()
Suspend this transaction from the current thread.protected final boolean
If this transaction current? Assume we have checked that we are actually a transaction! If not valid then abort this transaction here.
-
Field Details
-
TOP_LEVEL
public static final int TOP_LEVELThe types of transactions which can be created.- See Also:
-
NESTED
public static final int NESTED- See Also:
-
_theAction
protected com.arjuna.ats.internal.jts.ControlWrapper _theAction -
_theStatus
-
_timeout
protected int _timeout
-
-
Constructor Details
-
AtomicTransaction
public AtomicTransaction()Create a new transaction. It is not running at this stage. -
AtomicTransaction
protected AtomicTransaction(com.arjuna.ats.internal.jts.ControlWrapper tx)
-
-
Method Details
-
finalize
public void finalize() -
get_transaction_name
- Returns:
- the transaction name. Should only be used for debugging purposes.
- Throws:
org.omg.CORBA.SystemException
-
begin
Start the transaction.- Throws:
SubtransactionsUnavailable
- if subtransactions have been disabled, and the invoking thread already has a transaction associated with it.org.omg.CORBA.INVALID_TRANSACTION
- if the transaction has already begun or has completed.org.omg.CORBA.SystemException
-
commit
public void commit(boolean report_heuristics) throws NoTransaction, HeuristicMixed, HeuristicHazard, org.omg.CORBA.WrongTransaction, org.omg.CORBA.SystemException - Throws:
NoTransaction
HeuristicMixed
HeuristicHazard
org.omg.CORBA.WrongTransaction
org.omg.CORBA.SystemException
-
rollback
public void rollback() throws NoTransaction, org.omg.CORBA.WrongTransaction, org.omg.CORBA.SystemException- Throws:
NoTransaction
org.omg.CORBA.WrongTransaction
org.omg.CORBA.SystemException
-
set_timeout
public void set_timeout(int seconds) throws org.omg.CORBA.SystemException Set the transaction timeout. This is the same as calling org.omg.CosTransactions.Current.set_timeout().- Throws:
org.omg.CORBA.SystemException
-
get_timeout
public int get_timeout() throws org.omg.CORBA.SystemException- Returns:
- the timeout associated with transactions created by the current thread.
- Throws:
org.omg.CORBA.SystemException
-
getTimeout
public int getTimeout() throws org.omg.CORBA.SystemException- Returns:
- the timeout associated with this transaction.
- Throws:
org.omg.CORBA.SystemException
-
get_txcontext
- Returns:
- the propagation context for this transaction.
- Throws:
Inactive
- if the current transaction is no longer in the active phase.org.omg.CORBA.SystemException
- Since:
- JTS 2.1.
-
registerResource
public RecoveryCoordinator registerResource(Resource r) throws Inactive, org.omg.CORBA.SystemException Register the specified resource with this transaction.- Returns:
- the org.omg.CosTransactions.RecoveryCoordinator reference that can be used to later query the outcome of the transaction.
- Throws:
Inactive
- if the current transaction is no longer in the active phase.org.omg.CORBA.SystemException
-
registerSubtranAware
public void registerSubtranAware(SubtransactionAwareResource r) throws Inactive, NotSubtransaction, org.omg.CORBA.SystemException Register the specified subtransaction aware resource with this transaction. This transaction must be a subtransaction.- Throws:
Inactive
- if this transaction is no longer in the active phase.NotSubtransaction
- if this transaction is not a subtransaction.org.omg.CORBA.SystemException
-
registerSynchronization
public void registerSynchronization(Synchronization sync) throws Inactive, SynchronizationUnavailable, org.omg.CORBA.SystemException Register the specified synchronization with this transaction. This transaction must be a top-level transaction.- Throws:
Inactive
- if this transaction is no longer in the active phase.SynchronizationUnavailable
- if this transaction it not a top-level transaction.org.omg.CORBA.SystemException
-
control
- Returns:
- the org.omg.CosTransactions.Control reference to this transaction.
- Throws:
NoTransaction
org.omg.CORBA.SystemException
-
equals
-
suspend
public void suspend() throws NoTransaction, org.omg.CORBA.WrongTransaction, org.omg.CORBA.SystemExceptionSuspend this transaction from the current thread. This transaction must be active on the calling thread for this method to succeed.- Throws:
NoTransaction
- if there is no current transaction.org.omg.CORBA.WrongTransaction
- if the transaction associated with the current thread is different from this thread.org.omg.CORBA.SystemException
-
resume
Resume this transaction.- Throws:
InvalidControl
- if this transaction is invalid.org.omg.CORBA.SystemException
-
get_status
- Returns:
- the status of this transaction.
- Throws:
org.omg.CORBA.SystemException
-
rollbackOnly
Allow action commit to be supressed. Although the OTS would require an InactiveException if the transaction is not active, we ignore that via this route.- Throws:
org.omg.CORBA.SystemException
NoTransaction
-
hashCode
public int hashCode() -
get_uid
-
validTransaction
protected final boolean validTransaction()If this transaction current? Assume we have checked that we are actually a transaction! If not valid then abort this transaction here. Leave current alone. -
getStatus
-