com.atomikos.icatch
Interface CompositeTransaction

All Superinterfaces:
Stateful
All Known Implementing Classes:
AbstractCompositeTransaction, CompositeTransactionAdaptor, CompositeTransactionImp

public interface CompositeTransaction
extends Stateful

Represents a nested part of a global composite transaction. Each invocation of a server is represented by an instance of this type. For transaction proxies (instances that represent non-local transactions), all non-trivial methods are allowed to generate an exception of type UnsupportedOperationException. The only methods that always work for all instances are the simple getters and test methods.


Method Summary
 RecoveryCoordinator addParticipant(Participant participant)
           
 void addSubTxAwareParticipant(SubTxAwareParticipant subtxaware)
          Resources that support lock inheritance can use this feature to be notified whenever a lock should be inherited.
 void commit()
          Commits the composite transaction.
 CompositeTransaction createSubTransaction()
           
 CompositeCoordinator getCompositeCoordinator()
           
 Extent getExtent()
           
 Stack getLineage()
           
 int getLocalSubTxCount()
          Deprecated. This should not matter outside the core.
 Properties getProperties()
          Gets all properties of this instance.
 String getProperty(String name)
          Gets the specified metadata property.
 Object getState()
          Gets the current state.
 String getTid()
           
 long getTimeout()
           
 TransactionControl getTransactionControl()
          Deprecated. As from release 3.0, the methods in the TransactionControl interface have been moved to this one.
 boolean isAncestorOf(CompositeTransaction otherCompositeTransaction)
           
 boolean isDescendantOf(CompositeTransaction otherCompositeTransaction)
           
 boolean isLocal()
           
 boolean isRelatedTransaction(CompositeTransaction otherCompositeTransaction)
           
 boolean isRoot()
           
 boolean isSameTransaction(CompositeTransaction otherCompositeTransaction)
           
 boolean isSerial()
          Serial mode is an optimized way for lock inheritance: no locks among related transactions are necessary if all related transactions are executed serially with respect to each other.
 void registerSynchronization(Synchronization sync)
           
 void rollback()
          Rollback of the current transaction.
 void setProperty(String name, String value)
          Sets metadata property information on the transaction object.
 void setRollbackOnly()
          Marks the transaction so that the only possible termination is rollback.
 void setSerial()
          Sets the serial mode.
 void setTag(HeuristicMessage tag)
          Sets the tag for this transaction.
 

Method Detail

getState

Object getState()
Gets the current state.

Specified by:
getState in interface Stateful
Returns:
Object One of the state constants.
See Also:
TxState

isRoot

boolean isRoot()
Returns:
boolean True if this is the root transaction, i.e. the first transaction created in a (possibly distributed) hierarchy.

getLineage

Stack getLineage()
Returns:
Stack A stack of ancestors, bottom one is the root.

getTid

String getTid()
Returns:
String The tid for the tx.

isAncestorOf

boolean isAncestorOf(CompositeTransaction otherCompositeTransaction)
Parameters:
otherCompositeTransaction -
Returns:
boolean True if this instance is an ancestor of the supplied transaction.

isDescendantOf

boolean isDescendantOf(CompositeTransaction otherCompositeTransaction)
Parameters:
otherCompositeTransaction -
Returns:
boolean True if this instance is a descendant of the other instance.

isRelatedTransaction

boolean isRelatedTransaction(CompositeTransaction otherCompositeTransaction)
Parameters:
otherCompositeTransaction -
Returns:
True if related. That is: if both share the same root transaction.

isSameTransaction

boolean isSameTransaction(CompositeTransaction otherCompositeTransaction)
Parameters:
otherCompositeTransaction -
Returns:
True if both are the same.

getCompositeCoordinator

CompositeCoordinator getCompositeCoordinator()
                                             throws SysException
Returns:
CompositeCoordinator
Throws:
SysException

addParticipant

RecoveryCoordinator addParticipant(Participant participant)
                                   throws SysException,
                                          IllegalStateException
Parameters:
participant -
Returns:
RecoveryCoordinator Whom to ask for indoubt timeout resolution.
Throws:
SysException
IllegalStateException

registerSynchronization

void registerSynchronization(Synchronization sync)
                             throws IllegalStateException,
                                    SysException
Parameters:
sync -
Throws:
IllegalStateException
SysException

addSubTxAwareParticipant

void addSubTxAwareParticipant(SubTxAwareParticipant subtxaware)
                              throws SysException,
                                     IllegalStateException
Resources that support lock inheritance can use this feature to be notified whenever a lock should be inherited.

Parameters:
subtxaware -
Throws:
SysException
IllegalStateException

isSerial

boolean isSerial()
Serial mode is an optimized way for lock inheritance: no locks among related transactions are necessary if all related transactions are executed serially with respect to each other. The serial property is set by the root transaction and is propagated to all its subtransactions.

Returns:

getTransactionControl

TransactionControl getTransactionControl()
Deprecated. As from release 3.0, the methods in the TransactionControl interface have been moved to this one.


isLocal

boolean isLocal()
Returns:
boolean True if started in the local VM. For imported transactions, this is false.

createSubTransaction

CompositeTransaction createSubTransaction()
                                          throws SysException,
                                                 IllegalStateException
Throws:
SysException
IllegalStateException

setSerial

void setSerial()
               throws IllegalStateException,
                      SysException
Sets the serial mode. This only works on the root itself, and can not be undone. After this, no parallel calls are allowed in any descendant.

Throws:
IllegalStateException
SysException

getLocalSubTxCount

int getLocalSubTxCount()
Deprecated. This should not matter outside the core.


setTag

void setTag(HeuristicMessage tag)
Sets the tag for this transaction. This is returned as a summary of the local work in case the transaction was imported from a remote client TM.

Parameters:
tag -

getExtent

Extent getExtent()
Returns:
The extent.

getTimeout

long getTimeout()
Returns:
long The transaction timeout in millis.

setRollbackOnly

void setRollbackOnly()
Marks the transaction so that the only possible termination is rollback.


commit

void commit()
            throws HeurRollbackException,
                   HeurMixedException,
                   HeurHazardException,
                   SysException,
                   SecurityException,
                   RollbackException
Commits the composite transaction.

Throws:
HeurRollbackException - On heuristic rollback.
HeurMixedException - On heuristic mixed outcome.
SysException - For unexpected failures.
SecurityException - If calling thread does not have right to commit.
HeurHazardException - In case of heuristic hazard.
RollbackException - If the transaction was rolled back before prepare.

rollback

void rollback()
              throws IllegalStateException,
                     SysException
Rollback of the current transaction.

Throws:
IllegalStateException - If prepared or inactive.
SysException - If unexpected error.

setProperty

void setProperty(String name,
                 String value)
Sets metadata property information on the transaction object. Once set, metadata properties can't be overwritten. Properties are inherited by all subtransactions created after the set. Properties may or may not be propagated along with exported transactions (depending on the protocol).

Parameters:
name -
value -

getProperty

String getProperty(String name)
Gets the specified metadata property.

Parameters:
name - The name of the property.
Returns:
The property, or null if not set.

getProperties

Properties getProperties()
Gets all properties of this instance.

Returns:
The (cloned) properties of this transaction.


Copyright © 2012. All Rights Reserved.