TransactionContextHelper (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.resource.common
Class TransactionContextHelper

    java.lang.Object
      bitronix.tm.resource.common.TransactionContextHelper

    public class TransactionContextHelper

extends Object

Helper class that contains static logic common accross all resource types.

Author:
  lorban

Constructor Summary
`TransactionContextHelper()`

Method Summary
`static BitronixTransaction` | `currentTransaction()` Get the transaction running on the current thead context.
`static void` | `delistFromCurrentTransaction(XAResourceHolder xaResourceHolder)` Delist the `XAResourceHolder` from the current transaction or do nothing if there is no global transaction context for this thread.
`static void` | `enlistInCurrentTransaction(XAResourceHolder xaResourceHolder)` Enlist the `XAResourceHolder` in the current transaction or do nothing if there is no global transaction context for this thread.
`static void` | `recycle(XAStatefulHolder xaStatefulHolder)` Ensure the `XAStatefulHolder`'s release won't be deferred anymore (when appropriate) as it has been recycled.
`static void` | `requeue(XAStatefulHolder xaStatefulHolder, ResourceBean bean)` Switch the `XAStatefulHolder`'s state appropriately after the acquired resource handle has been closed.

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

Constructor Detail

### TransactionContextHelper

    public TransactionContextHelper()

Method Detail

### enlistInCurrentTransaction

    public static void enlistInCurrentTransaction(XAResourceHolder xaResourceHolder)
                                           throws SystemException,
                                                  RollbackException

  Enlist the `XAResourceHolder` in the current transaction or do nothing if there is no global transaction context for this thread.

  Parameters:
    `xaResourceHolder` - the `XAResourceHolder` to enlist.
  Throws:
    `SystemException` - if an internal error happens.
    `RollbackException` - if the current transaction has been marked as rollback only.

### delistFromCurrentTransaction

    public static void delistFromCurrentTransaction(XAResourceHolder xaResourceHolder)
                                             throws SystemException

  Delist the `XAResourceHolder` from the current transaction or do nothing if there is no global transaction context for this thread.

  Parameters:
    `xaResourceHolder` - the `XAResourceHolder` to delist.
  Throws:
    `SystemException` - if an internal error happens.

### currentTransaction

    public static BitronixTransaction currentTransaction()

  Get the transaction running on the current thead context.

  Returns:
    null if there is no transaction on the current context or if the transaction manager is not running.

### requeue

    public static void requeue(XAStatefulHolder xaStatefulHolder,
                               ResourceBean bean)
                        throws BitronixSystemException

  Switch the `XAStatefulHolder`'s state appropriately after the acquired resource handle has been closed. The pooled resource will either be marked as closed or not accessible, depending on the value of the bean's `deferConnectionRelease` property and will be marked for release after 2PC execution in the latter case.

  Parameters:
    `xaStatefulHolder` - the `XAStatefulHolder` to requeue.
    `bean` - the `ResourceBean` of the `XAResourceHolder`.
  Throws:
    `BitronixSystemException` - if an internal error happens.

### recycle

    public static void recycle(XAStatefulHolder xaStatefulHolder)

  Ensure the `XAStatefulHolder`'s release won't be deferred anymore (when appropriate) as it has been recycled.

  Parameters:
    `xaStatefulHolder` - the recycled `XAStatefulHolder`.

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.