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

## org.jboss.tm
Class TxManager

    java.lang.Object
      org.jboss.tm.TxManager

All Implemented Interfaces:
  JBossXATerminator, TransactionLocalDelegate, TransactionManager, TransactionPropagationContextFactory, TransactionPropagationContextImporter, TransactionTimeoutConfiguration, javax.resource.spi.XATerminator

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

Our TransactionManager implementation.

Version:
  $Revision: 1.21 $
Author:
  Rickard Öberg, Marc Fleury, Ole Husgaard, Jason Dillon, Francisco Reverbel, Adrian Brock

Method Summary
`void` | `associateThread(Transaction transaction)`
`void` | `begin()` Begin a new transaction.
`void` | `cancelWork(javax.resource.spi.work.Work work, Xid xid)` Invoked when the work fails
`void` | `commit()` Commit the transaction associated with the currently running thread.
`void` | `commit(Xid xid, boolean onePhase)`
`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.
`void` | `endWork(javax.resource.spi.work.Work work, Xid xid)` Invoked when transaction inflow work ends
`void` | `forget(Xid xid)`
`long` | `getCommitCount()` A count of the transactions that have been committed
`int` | `getDefaultTransactionTimeout()` Get the default transaction timeout.
`boolean` | `getGlobalIdsEnabled()` Getter for attribute `globalIdsEnabled`.
`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.
`boolean` | `isInterruptThreads()` Is thread interruption enabled at transaction timeout
`int` | `prepare(Xid xid)`
`Xid[]` | `recover(int flag)`
`void` | `registerWork(javax.resource.spi.work.Work work, Xid xid, long timeout)` Invoked for transaction inflow of work
`void` | `resume(Transaction transaction)` Resume a transaction.
`void` | `rollback()` Roll back the transaction associated with the currently running thread.
`void` | `rollback(Xid xid)`
`void` | `setDefaultTransactionTimeout(int seconds)` Set the default transaction timeout for new transactions.
`void` | `setGlobalIdsEnabled(boolean newValue)` Setter for attribute `globalIdsEnabled`.
`void` | `setInterruptThreads(boolean interruptThreads)` Enable/disable thread interruption at transaction timeout.
`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` | `startWork(javax.resource.spi.work.Work work, Xid xid)` Invoked for transaction inflow of work
`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.

### setGlobalIdsEnabled

    public void setGlobalIdsEnabled(boolean newValue)

  Setter for attribute `globalIdsEnabled`.

### getGlobalIdsEnabled

    public boolean getGlobalIdsEnabled()

  Getter for attribute `globalIdsEnabled`.

### setInterruptThreads

    public void setInterruptThreads(boolean interruptThreads)

  Enable/disable thread interruption at transaction timeout.

  Parameters:
    `interruptThreads` - pass true to interrupt threads, false otherwise

### isInterruptThreads

    public boolean isInterruptThreads()

  Is thread interruption enabled at transaction timeout

  Returns:
    true for interrupt threads, false otherwise

### 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()

  Description copied from interface: `TransactionTimeoutConfiguration`
  Get the transaction timeout.

  Specified by:
    `getTransactionTimeout` in interface `TransactionTimeoutConfiguration`
  Returns:
    the timeout in seconds associated with this thread

### 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 LocalId. 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`

### registerWork

    public void registerWork(javax.resource.spi.work.Work work,
                             Xid xid,
                             long timeout)
                      throws javax.resource.spi.work.WorkCompletedException

  Description copied from interface: `JBossXATerminator`
  Invoked for transaction inflow of work

  Specified by:
    `registerWork` in interface `JBossXATerminator`
  Parameters:
    `work` - the work starting
    `xid` - the xid of the work
    `timeout` - the transaction timeout
  Throws:
    `javax.resource.spi.work.WorkCompletedException` - with error code WorkException.TX_CONCURRENT_WORK_DISALLOWED when work is already present for the xid or whose completion is in progress, only the global part of the xid must be used for this check.

### startWork

    public void startWork(javax.resource.spi.work.Work work,
                          Xid xid)
                   throws javax.resource.spi.work.WorkCompletedException

  Description copied from interface: `JBossXATerminator`
  Invoked for transaction inflow of work

  Specified by:
    `startWork` in interface `JBossXATerminator`
  Parameters:
    `work` - the work starting
    `xid` - the xid of the work
  Throws:
    `javax.resource.spi.work.WorkCompletedException` - with error code WorkException.TX_RECREATE_FAILED if it is unable to recreate the transaction context

### endWork

    public void endWork(javax.resource.spi.work.Work work,
                        Xid xid)

  Description copied from interface: `JBossXATerminator`
  Invoked when transaction inflow work ends

  Specified by:
    `endWork` in interface `JBossXATerminator`
  Parameters:
    `work` - the work ending
    `xid` - the xid of the work

### cancelWork

    public void cancelWork(javax.resource.spi.work.Work work,
                           Xid xid)

  Description copied from interface: `JBossXATerminator`
  Invoked when the work fails

  Specified by:
    `cancelWork` in interface `JBossXATerminator`
  Parameters:
    `work` - the work ending
    `xid` - the xid of the work

### prepare

    public int prepare(Xid xid)
                throws XAException

  Specified by:
    `prepare` in interface `javax.resource.spi.XATerminator`
  Throws:
    `XAException`

### rollback

    public void rollback(Xid xid)
                  throws XAException

  Specified by:
    `rollback` in interface `javax.resource.spi.XATerminator`
  Throws:
    `XAException`

### commit

    public void commit(Xid xid,
                       boolean onePhase)
                throws XAException

  Specified by:
    `commit` in interface `javax.resource.spi.XATerminator`
  Throws:
    `XAException`

### forget

    public void forget(Xid xid)
                throws XAException

  Specified by:
    `forget` in interface `javax.resource.spi.XATerminator`
  Throws:
    `XAException`

### recover

    public Xid[] recover(int flag)
                  throws XAException

  Specified by:
    `recover` in interface `javax.resource.spi.XATerminator`
  Throws:
    `XAException`

### 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`

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

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