Save This Page
Home » jboss-5.0.0.CR1-src » org » jboss » tm » [javadoc | source]
org.jboss.tm
public class: TransactionLocal [javadoc | source]
java.lang.Object
   org.jboss.tm.TransactionLocal
A TransactionLocal is similar to ThreadLocal except it is keyed on the Transactions. A transaction local variable is cleared after the transaction completes.
Field Summary
protected final  TransactionManager transactionManager    The transaction manager is maintained by the system and manges the assocation of transaction to threads. 
protected  TransactionLocalDelegate delegate    The delegate 
Constructor:
 public TransactionLocal() 
 public TransactionLocal(TransactionManager tm) 
    Creates a thread local variable. Using the given transaction manager
    Parameters:
    tm - the transaction manager
Method from org.jboss.tm.TransactionLocal Summary:
containsValue,   get,   get,   getTransaction,   getValue,   initDelegate,   initialValue,   set,   set,   storeValue
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.tm.TransactionLocal Detail:
 protected boolean containsValue(Transaction tx) 
    does Transaction contain object?
 public Object get() 
    Returns the value of this TransactionLocal variable associated with the thread context transaction. Creates and initializes the copy if this is the first time the method is called in a transaction.
 public Object get(Transaction transaction) 
    Returns the value of this TransactionLocal variable associated with the specified transaction. Creates and initializes the copy if this is the first time the method is called in a transaction.
 protected Transaction getTransaction() 
 protected Object getValue(Transaction tx) 
    get the transaction local value.
 protected  void initDelegate() 
    Initialise the delegate
 protected Object initialValue() 
    Returns the initial value for this thransaction local. This method will be called once per accessing transaction for each TransactionLocal, the first time each transaction accesses the variable with get or set. If the programmer desires TransactionLocal variables to be initialized to some value other than null, TransactionLocal must be subclassed, and this method overridden. Typically, an anonymous inner class will be used. Typical implementations of initialValue will call an appropriate constructor and return the newly constructed object.
 public  void set(Object value) 
    Sets the value of this TransactionLocal variable associtated with the thread context transaction. This is only used to change the value from the one assigned by the initialValue method, and many applications will have no need for this functionality.
 public  void set(Transaction transaction,
    Object value) 
    Sets the value of this TransactionLocal variable associtated with the specified transaction. This is only used to change the value from the one assigned by the initialValue method, and many applications will have no need for this functionality.
 protected  void storeValue(Transaction tx,
    Object value) 
    put the value in the TransactionImpl map