BitronixTransactionManager (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

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

## bitronix.tm
Class BitronixTransactionManager

    java.lang.Object
      bitronix.tm.BitronixTransactionManager

All Implemented Interfaces:
  Service, Referenceable, TransactionManager, UserTransaction

    public class BitronixTransactionManager

extends Object
implements TransactionManager, UserTransaction, Referenceable, Service

Implementation of `TransactionManager` and `UserTransaction`.

Author:
  lorban

Constructor Summary
`BitronixTransactionManager()` Create the `BitronixTransactionManager`.

Method Summary
`void` | `begin()` Start a new transaction and bind the context to the calling thread.
`void` | `commit()`
`void` | `dumpTransactionContexts()` Dump an overview of all running transactions as debug logs.
`BitronixTransaction` | `getCurrentTransaction()` Get the transaction currently registered on the current thread context.
`Map` | `getInFlightTransactions()` Return all in-flight transactions.
`long` | `getOldestInFlightTransactionTimestamp()` Return the timestamp of the oldest in-flight transaction.
`Reference` | `getReference()` BitronixTransactionManager can only have a single instance per JVM so this method always returns a reference with no special information to find back the sole instance.
`int` | `getStatus()`
`Transaction` | `getTransaction()`
`void` | `resume(Transaction transaction)`
`void` | `rollback()`
`void` | `setRollbackOnly()`
`void` | `setTransactionTimeout(int seconds)`
`void` | `shutdown()` Shut down the transaction manager and release all resources held by it.
`Transaction` | `suspend()`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### BitronixTransactionManager

    public BitronixTransactionManager()

  Create the `BitronixTransactionManager`. Open the journal, load resources and perform recovery synchronously. The recovery service then gets scheduled for background recovery.

Method Detail

### begin

    public void begin()
               throws NotSupportedException,
                      SystemException

  Start a new transaction and bind the context to the calling thread.

  Specified by:
    `begin` in interface `TransactionManager`
  Specified by:
    `begin` in interface `UserTransaction`
  Throws:
    `NotSupportedException` - if a transaction is already bound to the calling thread.
    `SystemException` - if the transaction manager is shutting down.

### commit

    public void commit()
                throws RollbackException,
                       HeuristicMixedException,
                       HeuristicRollbackException,
                       SecurityException,
                       IllegalStateException,
                       SystemException

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

### rollback

    public void rollback()
                  throws IllegalStateException,
                         SecurityException,
                         SystemException

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

### getStatus

    public int getStatus()
                  throws SystemException

  Specified by:
    `getStatus` in interface `TransactionManager`
  Specified by:
    `getStatus` in interface `UserTransaction`
  Throws:
    `SystemException`

### getTransaction

    public Transaction getTransaction()
                               throws SystemException

  Specified by:
    `getTransaction` in interface `TransactionManager`
  Throws:
    `SystemException`

### setRollbackOnly

    public void setRollbackOnly()
                         throws IllegalStateException,
                                SystemException

  Specified by:
    `setRollbackOnly` in interface `TransactionManager`
  Specified by:
    `setRollbackOnly` in interface `UserTransaction`
  Throws:
    `IllegalStateException`
    `SystemException`

### setTransactionTimeout

    public void setTransactionTimeout(int seconds)
                               throws SystemException

  Specified by:
    `setTransactionTimeout` in interface `TransactionManager`
  Specified by:
    `setTransactionTimeout` in interface `UserTransaction`
  Throws:
    `SystemException`

### suspend

    public Transaction suspend()
                        throws SystemException

  Specified by:
    `suspend` in interface `TransactionManager`
  Throws:
    `SystemException`

### resume

    public void resume(Transaction transaction)
                throws InvalidTransactionException,
                       IllegalStateException,
                       SystemException

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

### getReference

    public Reference getReference()
                           throws NamingException

  BitronixTransactionManager can only have a single instance per JVM so this method always returns a reference with no special information to find back the sole instance. BitronixTransactionManagerObjectFactory will be used by the JNDI server to get the BitronixTransactionManager instance of the JVM.

  Specified by:
    `getReference` in interface `Referenceable`
  Returns:
    an empty reference to get the BitronixTransactionManager.
  Throws:
    `NamingException`

### getInFlightTransactions

    public Map getInFlightTransactions()

  Return all in-flight transactions.

  Returns:
    a map of `BitronixTransaction` objects using `Uid` as key and `BitronixTransaction` as value.

### getOldestInFlightTransactionTimestamp

    public long getOldestInFlightTransactionTimestamp()

  Return the timestamp of the oldest in-flight transaction.

  Returns:
    the timestamp or Long.MIN_VALUE if there is no in-flight transaction.

### getCurrentTransaction

    public BitronixTransaction getCurrentTransaction()

  Get the transaction currently registered on the current thread context.

  Returns:
    the current transaction or null if no transaction has been started on the current thread.

### dumpTransactionContexts

    public void dumpTransactionContexts()

  Dump an overview of all running transactions as debug logs.

### shutdown

    public void shutdown()

  Shut down the transaction manager and release all resources held by it.

  This call will also close the resources pools registered by the `ResourceLoader` like JMS and JDBC pools. The manually created ones are left untouched.

  The Transaction Manager will wait during a configurable graceful period before forcibly killing active transactions.

  After this method is called, attempts to create new transactions (via calls to `TransactionManager.begin()`) will be rejected with a `SystemException`.

  Specified by:
    `shutdown` in interface `Service`
  See Also:
    `Configuration.getGracefulShutdownInterval()`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.