Framework Professional Edition Package


org.mbs.services.transaction
Interface TransactionManager


public interface TransactionManager

The Transaction Manager service acts as a factory for Transaction objects. It will associate these objects with the current thread.

Author:
Valentin Valchev

Method Summary
 Transaction begin()
          Create a new open transaction.
 long checkTimedoutTransactions()
          This method should be called by a watch-dog to ensure, that the transaction manager will clean up the blocked transactions.
 TransactionContext getTransaction()
          Answer the transaction associated with the current thread.
 TransactionContext[] listTransactions(java.lang.String resourceName)
          Return a list of transactions that were restored after fail-back and associated with the specified resource name.
 

Method Detail

begin

Transaction begin()
Create a new open transaction. The transaction object is created and its status is set to STATUS_ACTIVE. The current thread will be associated with the transaction so that the current transaction can be retrieved by any resource managers.

Returns:
a new Transaction object in the active state
Throws:
java.lang.IllegalStateException - When there already is an open transaction associated with the current thread.
java.lang.SecurityException - if the called doesn't have the required permissions

getTransaction

TransactionContext getTransaction()
Answer the transaction associated with the current thread.

Returns:
The currently associated transaction or null.
Throws:
java.lang.SecurityException - if the called doesn't have the required permissions

listTransactions

TransactionContext[] listTransactions(java.lang.String resourceName)
Return a list of transactions that were restored after fail-back and associated with the specified resource name. These are not yet committed or rolled-back transactions, since the Transaction Manager deletes them. However, their status could be different, compared to the state just before the power fail occurred.

Parameters:
resourceName - the class name of the Resource. If this parameter is null, then all transactions are listed. This is particularly useful for debugging purpose.
Returns:
A list of transactions that were restored or null if there are no transaction, that are associated with the specified resource.
Throws:
java.lang.SecurityException - if the called doesn't have the required permissions

checkTimedoutTransactions

long checkTimedoutTransactions()
This method should be called by a watch-dog to ensure, that the transaction manager will clean up the blocked transactions. Note, that even if transaction is delayed, the transaction manager may not roll-back it immediately. However, it is certain that timed out transaction is marked as roll-back only.

Returns:
the delay in milliseconds, after which, the timer thread should check again to timed out transactions. Notice, that this method may return 0, which usually means, that there are no active transactions. However, if you sleep with 'zero' this means 'sleep forever'. So take care!

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved