com.atomikos.icatch
Interface CompositeTransactionManager

All Known Implementing Classes:
BaseTransactionManager

public interface CompositeTransactionManager

A composite transaction manager. This interface outlines the API for managing composite transactions in the local VM.


Method Summary
 CompositeTransaction createCompositeTransaction(long timeout)
          Starts a new (sub)transaction (not an activity) for the current thread.
 CompositeTransaction getCompositeTransaction()
          Gets the composite transaction for the current thread.
 CompositeTransaction getCompositeTransaction(String tid)
          Gets the composite transaction with the given id.
 void resume(CompositeTransaction ct)
          Re-maps the thread to the given tx.
 CompositeTransaction suspend()
          Suspends the tx for the current thread.
 

Method Detail

createCompositeTransaction

CompositeTransaction createCompositeTransaction(long timeout)
                                                throws SysException,
                                                       IllegalStateException
Starts a new (sub)transaction (not an activity) for the current thread. Associates the current thread with that instance.
NOTE: subtransactions should not be mixed: either each subtransaction is an activity, or not (default). Use suspend/resume if mixed models are necessary: for instance, if you want to create a normal transaction within an activity, then suspend the activity first before starting the transaction. Afterwards, resume the activity.

Returns:
CompositeTransaction The new instance.
Throws:
SysException - Unexpected error.
IllegalStateException - If there is an existing transaction that is an activity instead of a classical transaction.

getCompositeTransaction

CompositeTransaction getCompositeTransaction()
                                             throws SysException
Gets the composite transaction for the current thread.

Returns:
CompositeTransaction The instance for the current thread, null if none.
Throws:
SysException - Unexpected failure.

getCompositeTransaction

CompositeTransaction getCompositeTransaction(String tid)
                                             throws SysException
Gets the composite transaction with the given id. This method is useful e.g. for retrieving a suspended transaction by its id.

Parameters:
tid - The id of the transaction.
Returns:
CompositeTransaction The transaction with the given id, or null if not found.
Throws:
SysException - Unexpected failure.

resume

void resume(CompositeTransaction ct)
            throws IllegalStateException,
                   SysException
Re-maps the thread to the given tx.

Parameters:
ct - The CompositeTransaction to resume.
Throws:
IllegalStateException - If thread has tx already.
SysException - Unexpected failure.

suspend

CompositeTransaction suspend()
                             throws SysException
Suspends the tx for the current thread.

Returns:
CompositeTransaction The transaction for the current thread.
Throws:
SysException - On failure.


Copyright © 2011. All Rights Reserved.