com.atomikos.icatch
Interface CompositeTransactionManager

All Known Implementing Classes:
BaseTransactionManager, TrmiTransactionManager

public interface CompositeTransactionManager

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()
           
 CompositeTransaction getCompositeTransaction(String tid)
          Gets the composite transaction with the given id.
 void resume(CompositeTransaction compositeTransaction)
          Re-maps the calling thread to the given transaction.
 CompositeTransaction suspend()
          Suspends the transaction context 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.

Parameters:
Timeout - (in millis) for the transaction.
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
Returns:
CompositeTransaction The instance for the current thread, null if none.
Throws:
SysException - On 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 compositeTransaction)
            throws IllegalStateException,
                   SysException
Re-maps the calling thread to the given transaction.

Parameters:
compositeTransaction -
Throws:
IllegalStateException - If this thread has a transaction context already.
SysException

suspend

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

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


Copyright © 2012. All Rights Reserved.