Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.atomikos.icatch.imp
Class AbstractCompositeTransaction

    java.lang.Object
      com.atomikos.icatch.imp.AbstractCompositeTransaction

All Implemented Interfaces:
  Stateful, CompositeTransaction, Serializable

Direct Known Subclasses:
  CompositeTransactionAdaptor, CompositeTransactionImp

    public abstract class AbstractCompositeTransaction

extends Object
implements CompositeTransaction, Serializable

An abstract base implementation of CompositeTransaction, for common behaviour of both proxy and local instances.

See Also:
  Serialized Form

Field Summary
`protected Stack` | `lineage_`
`protected Properties` | `properties_`
`protected boolean` | `serial_`
`protected HeuristicMessage` | `tag_`
`protected String` | `tid_`

Constructor Summary
`AbstractCompositeTransaction()` Required for externalization of subclasses
`AbstractCompositeTransaction(String tid, Stack lineage, boolean serial)` Constructor.

Method Summary
`RecoveryCoordinator` | `addParticipant(Participant participant)` Add a new participant.
`void` | `addSubTxAwareParticipant(SubTxAwareParticipant subtxaware)` Register a participant on behalf of a subtransaction, to be notified as soon as the locally finished state is reached.
`void` | `commit()` Commit the composite transaction.
`CompositeTransaction` | `createSubTransaction()` Create a subtx for this transaction.
`boolean` | `equals(Object obj)`
`CompositeCoordinator` | `getCompositeCoordinator()` Get the coordinator for this tx.
`Extent` | `getExtent()` Get the extent for the transaction.
`Stack` | `getLineage()` Get the ancestor info.
`int` | `getLocalSubTxCount()` Get the number of subtxs that were locally started for this instance.
`Properties` | `getProperties()` Gets all properties of this instance.
`String` | `getProperty(String name)` Gets the specified metadata property.
`Object` | `getState()` Get the current state.
`String` | `getTid()` Getter for tid.
`long` | `getTimeout()` Get the timeout in ms.
`TransactionControl` | `getTransactionControl()` Get a control object for this tx.
`int` | `hashCode()`
`boolean` | `isAncestorOf(CompositeTransaction ct)` Test if this instance is an ancestor of ct.
`boolean` | `isDescendantOf(CompositeTransaction ct)` Test if this instance is a descendant of ct.
`boolean` | `isLocal()` Test if the transaction is a locally started transaction or not.
`boolean` | `isRelatedTransaction(CompositeTransaction ct)` Test if this instance is related to ct.
`boolean` | `isRoot()` Test if this instance is a root or not.
`boolean` | `isSameTransaction(CompositeTransaction ct)` Test if this intance represents the same transaction as ct.
`boolean` | `isSerial()` Test if serial tx or not.
`void` | `registerSynchronization(Synchronization sync)` Add a synchronization callback.
`void` | `rollback()` Rollback 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()` Set serial mode for root.
`void` | `setTag(HeuristicMessage tag)` Sets the tag for this transaction.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### lineage_

    protected Stack lineage_

### tid_

    protected String tid_

### serial_

    protected boolean serial_

### tag_

    protected HeuristicMessage tag_

### properties_

    protected Properties properties_

Constructor Detail

### AbstractCompositeTransaction

    public AbstractCompositeTransaction()

  Required for externalization of subclasses

### AbstractCompositeTransaction

    public AbstractCompositeTransaction(String tid,
                                        Stack lineage,
                                        boolean serial)

  Constructor.

Method Detail

### getTid

    public String getTid()

  Description copied from interface: `CompositeTransaction`
  Getter for tid.

  Specified by:
    `getTid` in interface `CompositeTransaction`
  Returns:
    String The tid for the tx.
  See Also:
    `CompositeTransaction.`

### setTag

    public void setTag(HeuristicMessage tag)

  Description copied from interface: `CompositeTransaction`
  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.

  Specified by:
    `setTag` in interface `CompositeTransaction`
  Parameters:
    `tag` - The tag to add to the transaction.
  See Also:
    `CompositeTransaction.`

### isSerial

    public boolean isSerial()

  Description copied from interface: `CompositeTransaction`
  Test if serial tx or not. 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.

  Specified by:
    `isSerial` in interface `CompositeTransaction`
  Returns:
    boolean True iff all for root is serial.
  See Also:
    `CompositeTransaction.`

### isLocal

    public boolean isLocal()

  Description copied from interface: `CompositeTransaction`
  Test if the transaction is a locally started transaction or not.

  Specified by:
    `isLocal` in interface `CompositeTransaction`
  Returns:
    boolean True iff started in the local VM. For imported transactions, this is false.
  See Also:
    `Defaults to false.`

### getTransactionControl

    public TransactionControl getTransactionControl()
                                             throws UnsupportedOperationException

  Description copied from interface: `CompositeTransaction`
  Get a control object for this tx.

  Specified by:
    `getTransactionControl` in interface `CompositeTransaction`
  Returns:
    TransactionControl a control object.
  Throws:
    `UnsupportedOperationException`
  See Also:
    `CompositeTransaction.`

### addParticipant

    public RecoveryCoordinator addParticipant(Participant participant)
                                       throws SysException,
                                              IllegalStateException

  Description copied from interface: `CompositeTransaction`
  Add a new participant.

  Specified by:
    `addParticipant` in interface `CompositeTransaction`
  Parameters:
    `participant` - The participant to add.
  Returns:
    RecoveryCoordinator Whom to ask for indoubt timeout resolution.
  Throws:
    `SysException` - Unexpected.
    `IllegalStateException` - Illegal state.
  See Also:
    `CompositeTransaction`

### registerSynchronization

    public void registerSynchronization(Synchronization sync)
                                 throws IllegalStateException,
                                        UnsupportedOperationException,
                                        SysException

  Description copied from interface: `CompositeTransaction`
  Add a synchronization callback.

  Specified by:
    `registerSynchronization` in interface `CompositeTransaction`
  Parameters:
    `sync` - The callback object.
  Throws:
    `IllegalStateException` - If no tx longer active.
    `SysException` - Unexptected failure.
    `UnsupportedOperationException`
  See Also:
    `CompositeTransaction`

### getLineage

    public Stack getLineage()

  Description copied from interface: `CompositeTransaction`
  Get the ancestor info.

  Specified by:
    `getLineage` in interface `CompositeTransaction`
  Returns:
    Stack A stack of ancestors, bottom one is root.
  See Also:
    `CompositeTransaction.`

### isRoot

    public boolean isRoot()

  Description copied from interface: `CompositeTransaction`
  Test if this instance is a root or not. Note: a root is the top-level transaction; that is: the first transaction that was created in the distributed transaction hierarchy.

  Specified by:
    `isRoot` in interface `CompositeTransaction`
  Returns:
    True if this is the root.
  See Also:
    `CompositeTransaction.`

### isAncestorOf

    public boolean isAncestorOf(CompositeTransaction ct)

  Description copied from interface: `CompositeTransaction`
  Test if this instance is an ancestor of ct.

  Specified by:
    `isAncestorOf` in interface `CompositeTransaction`
  Parameters:
    `ct` - The argument to test for ancestor.
  Returns:
    boolean True iff this is an ancestor of ct.
  See Also:
    `CompositeTransaction.`

### isDescendantOf

    public boolean isDescendantOf(CompositeTransaction ct)

  Description copied from interface: `CompositeTransaction`
  Test if this instance is a descendant of ct.

  Specified by:
    `isDescendantOf` in interface `CompositeTransaction`
  Parameters:
    `ct` - The argument to test for descendant.
  Returns:
    boolean True iff this instance is a descendant of ct.
  See Also:
    `CompositeTransaction.`

### isRelatedTransaction

    public boolean isRelatedTransaction(CompositeTransaction ct)

  Description copied from interface: `CompositeTransaction`
  Test if this instance is related to ct.

  Specified by:
    `isRelatedTransaction` in interface `CompositeTransaction`
  Returns:
    True if related. That is: if both share the same root transaction.
  See Also:
    `CompositeTransaction.`

### isSameTransaction

    public boolean isSameTransaction(CompositeTransaction ct)

  Description copied from interface: `CompositeTransaction`
  Test if this intance represents the same transaction as ct.

  Specified by:
    `isSameTransaction` in interface `CompositeTransaction`
  Returns:
    True iff the same.
  See Also:
    `CompositeTransaction.`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### getCompositeCoordinator

    public CompositeCoordinator getCompositeCoordinator()
                                                 throws SysException,
                                                        UnsupportedOperationException

  Description copied from interface: `CompositeTransaction`
  Get the coordinator for this tx.

  Specified by:
    `getCompositeCoordinator` in interface `CompositeTransaction`
  Returns:
    CompositeCoordinator The composite coordinator instance.
  Throws:
    `SysException` - On failure.
    `UnsupportedOperationException`
  See Also:
    `CompositeTransaction.`

### addSubTxAwareParticipant

    public void addSubTxAwareParticipant(SubTxAwareParticipant subtxaware)
                                  throws SysException,
                                         UnsupportedOperationException,
                                         IllegalStateException

  Description copied from interface: `CompositeTransaction`
  Register a participant on behalf of a subtransaction, to be notified as soon as the locally finished state is reached. Resources that support lock inheritance can use this feature to be notified whenever a lock should be inherited.

  Specified by:
    `addSubTxAwareParticipant` in interface `CompositeTransaction`
  Parameters:
    `subtxaware` - The participant to be notified on local termination.
  Throws:
    `IllegalStateException` - If no longer active.
    `SysException`
    `UnsupportedOperationException`
  See Also:
    `CompositeTransaction`

### createSubTransaction

    public CompositeTransaction createSubTransaction()
                                              throws SysException,
                                                     IllegalStateException

  Description copied from interface: `CompositeTransaction`
  Create a subtx for this transaction. For activities, the subtransaction will also be an activity.

  Specified by:
    `createSubTransaction` in interface `CompositeTransaction`
  Returns:
    CompositeTransaction The subtx.
  Throws:
    `IllegalStateException` - If no longer active.
    `SysException`
  See Also:
    `CompositeTransaction.createSubTransaction()`

### setSerial

    public void setSerial()
                   throws IllegalStateException,
                          SysException

  Description copied from interface: `CompositeTransaction`
  Set serial mode for root. This only works on the root itself, and can not be undone. After this, no parallel calls are allowed in any descendant.

  Specified by:
    `setSerial` in interface `CompositeTransaction`
  Throws:
    `IllegalStateException` - If called for non-root tx.
    `SysException` - For unexpected errors.
  See Also:
    `CompositeTransaction.setSerial()`

### getLocalSubTxCount

    public int getLocalSubTxCount()

  Description copied from interface: `CompositeTransaction`
  Get the number of subtxs that were locally started for this instance.

  Specified by:
    `getLocalSubTxCount` in interface `CompositeTransaction`
  Returns:
    int The number of locally started subtxs.
  See Also:
    `CompositeTransaction.getLocalSubTxCount()`

### getExtent

    public Extent getExtent()

  Description copied from interface: `CompositeTransaction`
  Get the extent for the transaction.

  Specified by:
    `getExtent` in interface `CompositeTransaction`
  See Also:
    `CompositeTransaction.getExtent()`

### getTimeout

    public long getTimeout()

  Description copied from interface: `CompositeTransaction`
  Get the timeout in ms.

  Specified by:
    `getTimeout` in interface `CompositeTransaction`
  Returns:
    long The timeout, in ms, of the tx.
  See Also:
    `CompositeTransaction.getTimeout()`

### setRollbackOnly

    public void setRollbackOnly()

  Description copied from interface: `CompositeTransaction`
  Marks the transaction so that the only possible termination is rollback.

  Specified by:
    `setRollbackOnly` in interface `CompositeTransaction`
  See Also:
    `CompositeTransaction.setRollbackOnly()`

### commit

    public void commit()
                throws HeurRollbackException,
                       HeurMixedException,
                       HeurHazardException,
                       SysException,
                       SecurityException,
                       RollbackException

  Description copied from interface: `CompositeTransaction`
  Commit the composite transaction.

  Specified by:
    `commit` in interface `CompositeTransaction`
  Throws:
    `HeurRollbackException` - On heuristic rollback.
    `HeurMixedException` - On heuristic mixed outcome.
    `HeurHazardException` - In case of heuristic hazard.
    `SysException` - For unexpected failures.
    `SecurityException` - If calling thread does not have right to commit.
    `RollbackException` - If the transaction was rolled back before prepare.
  See Also:
    `CompositeTransaction.commit()`

### rollback

    public void rollback()
                  throws IllegalStateException,
                         SysException

  Description copied from interface: `CompositeTransaction`
  Rollback the current transaction.

  Specified by:
    `rollback` in interface `CompositeTransaction`
  Throws:
    `IllegalStateException` - If prepared or inactive.
    `SysException` - If unexpected error.
  See Also:
    `CompositeTransaction.rollback()`

### setProperty

    public void setProperty(String name,
                            String value)

  Description copied from interface: `CompositeTransaction`
  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).

  Specified by:
    `setProperty` in interface `CompositeTransaction`

### getProperty

    public String getProperty(String name)

  Description copied from interface: `CompositeTransaction`
  Gets the specified metadata property.

  Specified by:
    `getProperty` in interface `CompositeTransaction`
  Parameters:
    `name` - The name of the property.
  Returns:
    The property, or null if not set.

### getProperties

    public Properties getProperties()

  Description copied from interface: `CompositeTransaction`
  Gets all properties of this instance.

  Specified by:
    `getProperties` in interface `CompositeTransaction`
  Returns:
    The (cloned) properties of this transaction.

### getState

    public Object getState()

  Description copied from interface: `CompositeTransaction`
  Get the current state.

  Specified by:
    `getState` in interface `Stateful`
  Specified by:
    `getState` in interface `CompositeTransaction`
  Returns:
    The object representing the state.
  See Also:
    `com.atomikos.finitestates.Stateful.`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.