站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 transaction API Documentation 英文版文档

TxManager (JBoss Transaction API) - JBoss 3.2.7 transaction API Documentation 英文版文档


org.jboss.tm
Class TxManager

java.lang.Object
  extended byorg.jboss.tm.TxManager
All Implemented Interfaces:
TransactionLocalDelegate, TransactionManager, TransactionPropagationContextFactory, TransactionPropagationContextImporter, TransactionTimeoutConfiguration

public class TxManager
extends Object
implements TransactionManager, TransactionPropagationContextImporter, TransactionPropagationContextFactory, TransactionLocalDelegate, TransactionTimeoutConfiguration

Our TransactionManager implementation.

Version:
$Revision: 1.3.2.10 $
Author:
Rickard 脰berg, Marc Fleury, Ole Husgaard, Jason Dillon

Method Summary
 void associateThread(Transaction transaction)
           
 void begin()
          Begin a new transaction.
 void commit()
          Commit the transaction associated with the currently running thread.
 boolean containsValue(TransactionLocal local, Transaction tx)
          does TransactionImpl contain object?
 Transaction disassociateThread()
          The following 2 methods are here to provide association and disassociation of the thread.
 long getCommitCount()
          A count of the transactions that have been committed
 int getDefaultTransactionTimeout()
          Get the default transaction timeout.
static TxManager getInstance()
          Get a reference to the singleton instance.
 long getRollbackCount()
          A count of the transactions that have been rolled back
 int getStatus()
          Return the status of the transaction associated with the currently running thread, or Status.STATUS_NO_TRANSACTION if no active transaction is currently associated.
 Transaction getTransaction()
          Return the transaction currently associated with the invoking thread, or null if no active transaction is currently associated.
 int getTransactionCount()
          Return the number of active transactions
 Object getTransactionPropagationContext()
          Return a TPC for the current transaction.
 Object getTransactionPropagationContext(Transaction tx)
          Return a TPC for the argument transaction.
 int getTransactionTimeout()
          Get the transaction timeout.
 Object getValue(TransactionLocal local, Transaction tx)
          get the transaction local value.
 Transaction importTransactionPropagationContext(Object tpc)
          Import a transaction propagation context into this TM.
 void resume(Transaction transaction)
          Resume a transaction.
 void rollback()
          Roll back the transaction associated with the currently running thread.
 void setDefaultTransactionTimeout(int seconds)
          Set the default transaction timeout for new transactions.
 void setRollbackOnly()
          Mark the transaction associated with the currently running thread so that the only possible outcome is a rollback.
 void setTransactionTimeout(int seconds)
          Set the transaction timeout for new transactions started by the calling thread.
 void storeValue(TransactionLocal local, Transaction tx, Object value)
          put the value in the TransactionImpl map
 Transaction suspend()
          Suspend the transaction currently associated with the current thread, and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TxManager getInstance()
Get a reference to the singleton instance.


begin

public void begin()
           throws NotSupportedException,
                  SystemException
Begin a new transaction. The new transaction will be associated with the calling thread.

Specified by:
begin in interface TransactionManager
Throws:
NotSupportedException
SystemException

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SecurityException,
                   IllegalStateException,
                   SystemException
Commit the transaction associated with the currently running thread.

Specified by:
commit in interface TransactionManager
Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SecurityException
IllegalStateException
SystemException

getStatus

public int getStatus()
              throws SystemException
Return the status of the transaction associated with the currently running thread, or Status.STATUS_NO_TRANSACTION if no active transaction is currently associated.

Specified by:
getStatus in interface TransactionManager
Throws:
SystemException

getTransaction

public Transaction getTransaction()
                           throws SystemException
Return the transaction currently associated with the invoking thread, or null if no active transaction is currently associated.

Specified by:
getTransaction in interface TransactionManager
Throws:
SystemException

resume

public void resume(Transaction transaction)
            throws InvalidTransactionException,
                   IllegalStateException,
                   SystemException
Resume a transaction. Note: This will not enlist any resources involved in this transaction. According to JTA1.0.1 specification section 3.2.3, that is the responsibility of the application server.

Specified by:
resume in interface TransactionManager
Throws:
InvalidTransactionException
IllegalStateException
SystemException

suspend

public Transaction suspend()
                    throws SystemException
Suspend the transaction currently associated with the current thread, and return it. Note: This will not delist any resources involved in this transaction. According to JTA1.0.1 specification section 3.2.3, that is the responsibility of the application server.

Specified by:
suspend in interface TransactionManager
Throws:
SystemException

rollback

public void rollback()
              throws IllegalStateException,
                     SecurityException,
                     SystemException
Roll back the transaction associated with the currently running thread.

Specified by:
rollback in interface TransactionManager
Throws:
IllegalStateException
SecurityException
SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Mark the transaction associated with the currently running thread so that the only possible outcome is a rollback.

Specified by:
setRollbackOnly in interface TransactionManager
Throws:
IllegalStateException
SystemException

getTransactionTimeout

public int getTransactionTimeout()
                          throws SystemException
Description copied from interface: TransactionTimeoutConfiguration
Get the transaction timeout.

Specified by:
getTransactionTimeout in interface TransactionTimeoutConfiguration
Returns:
the timeout in seconds associated with this thread
Throws:
SystemException - for any error

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Set the transaction timeout for new transactions started by the calling thread.

Specified by:
setTransactionTimeout in interface TransactionManager
Throws:
SystemException

setDefaultTransactionTimeout

public void setDefaultTransactionTimeout(int seconds)
Set the default transaction timeout for new transactions. This default value is used if setTransactionTimeout() was never called, or if it was called with a value of 0.


getDefaultTransactionTimeout

public int getDefaultTransactionTimeout()
Get the default transaction timeout.

Returns:
Default transaction timeout in seconds.

disassociateThread

public Transaction disassociateThread()
The following 2 methods are here to provide association and disassociation of the thread.


associateThread

public void associateThread(Transaction transaction)

getTransactionCount

public int getTransactionCount()
Return the number of active transactions


getCommitCount

public long getCommitCount()
A count of the transactions that have been committed


getRollbackCount

public long getRollbackCount()
A count of the transactions that have been rolled back


importTransactionPropagationContext

public Transaction importTransactionPropagationContext(Object tpc)
Import a transaction propagation context into this TM. The TPC is loosely typed, as we may (at a later time) want to import TPCs that come from other transaction domains without offloading the conversion to the client.

Specified by:
importTransactionPropagationContext in interface TransactionPropagationContextImporter
Parameters:
tpc - The transaction propagation context that we want to import into this TM. Currently this is an instance of GlobalId. At some later time this may be an instance of a transaction propagation context from another transaction domain like org.omg.CosTransactions.PropagationContext.
Returns:
A transaction representing this transaction propagation context, or null if this TPC cannot be imported.

getTransactionPropagationContext

public Object getTransactionPropagationContext()
Return a TPC for the current transaction.

Specified by:
getTransactionPropagationContext in interface TransactionPropagationContextFactory

getTransactionPropagationContext

public Object getTransactionPropagationContext(Transaction tx)
Return a TPC for the argument transaction.

Specified by:
getTransactionPropagationContext in interface TransactionPropagationContextFactory

getValue

public Object getValue(TransactionLocal local,
                       Transaction tx)
get the transaction local value. Pull it from the TransactionImpl object

Specified by:
getValue in interface TransactionLocalDelegate

storeValue

public void storeValue(TransactionLocal local,
                       Transaction tx,
                       Object value)
put the value in the TransactionImpl map

Specified by:
storeValue in interface TransactionLocalDelegate

containsValue

public boolean containsValue(TransactionLocal local,
                             Transaction tx)
does TransactionImpl contain object?

Specified by:
containsValue in interface TransactionLocalDelegate


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.