BEA Systems, Inc.

BEA WebLogic Server 9.1 API Reference


weblogic.transaction
Class TransactionHelper

java.lang.Object
  extended byweblogic.transaction.TransactionHelper

public abstract class TransactionHelper
extends Object

Helper for managing transactions required by higher-level functionality.

See Also:
This helper allows the local TM to be replaced at will, unfortunately this is quite difficult to accomodate with the use of InitialContext. InitialContext is totally bogus if you try and use multiple protocols. It essentially sets global properties (such as the current user for the thread), even though it appears to be scoped. This means, for instance, that if you create a new InitialContext, get a remote object then created a different InitialContext you will get the properties of the second context if you invoke on the object. The same applies to multiple protocols, for instance using t3 followed by iiop. Thus it is necessary for the TransactionHelper to be `pushed' - as is the current Subject - to give the illusion of multiple protocols working in harmony. The alternatives are: 1. Have a single TM for all protocols. This doesn't work very well in the thin-client where we need to do something completely different. 2. Have mutually exclusive `native' and `foreign' TMs, in other words use the standard JTA TM in both the WLS-IIOP client and the t3 client and something different in the JDK client. This would preclude using t3 and the JDK client together, which currently works. IMPORTANT: these interfaces should not reference any classes outside of the JDK.
Copyright © 2005 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
TransactionHelper()
           
 
Method Summary
 Transaction getTransaction()
          Gets the transaction associated with this thread.
static TransactionHelper getTransactionHelper()
          Get the TransactionHelper singleton.
abstract  ClientTransactionManager getTransactionManager()
          Return an implementation of TransactionManager suitable for use in the current client.
abstract  UserTransaction getUserTransaction()
          Return an implementation of UserTransaction suitable for use in the current client.
static TransactionHelper popTransactionHelper()
          Pop the TransactionHelper singleton.
static void pushTransactionHelper(TransactionHelper helper)
          Push the TransactionHelper singleton.
static void setTransactionHelper(TransactionHelper helper)
          Set the TransactionHelper singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionHelper

public TransactionHelper()
Method Detail

getTransaction

public Transaction getTransaction()
Gets the transaction associated with this thread. This simply calls TransactionManager.getTransaction().

Returns:
null (if there is no associated transaction or if an exception was raised)
See Also:
TransactionManager.getTransaction()

getTransactionHelper

public static TransactionHelper getTransactionHelper()
Get the TransactionHelper singleton.

Returns:
A suitable TransactionHelper implementation for client or server.

getTransactionManager

public abstract ClientTransactionManager getTransactionManager()
Return an implementation of TransactionManager suitable for use in the current client.

See Also:
TransactionManager

getUserTransaction

public abstract UserTransaction getUserTransaction()
Return an implementation of UserTransaction suitable for use in the current client.

See Also:
UserTransaction

popTransactionHelper

public static TransactionHelper popTransactionHelper()
                                              throws EmptyStackException
Pop the TransactionHelper singleton. This does nothing in a server since there only can ever be one TM.

Throws:
EmptyStackException

pushTransactionHelper

public static void pushTransactionHelper(TransactionHelper helper)
Push the TransactionHelper singleton. This does nothing in a server since there only can ever be one TM.

Parameters:
helper - - a suitable TransactionHelper implementation for client or server.

setTransactionHelper

public static void setTransactionHelper(TransactionHelper helper)
Set the TransactionHelper singleton. This should be set at startup and not synchronized.

Parameters:
helper - - a suitable TransactionHelper implementation for client or server.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs91
Copyright 2005 BEA Systems Inc.