| |
|
| java.lang.Object org.jboss.tm.TransactionLocal
TransactionLocal | public class TransactionLocal (Code) | | A TransactionLocal is similar to ThreadLocal except it is keyed on the
Transactions. A transaction local variable is cleared after the transaction
completes.
author: Dain Sundstrom author: Bill Burke version: $Revision: 57208 $ |
Constructor Summary | |
public | TransactionLocal() Creates a thread local variable. | public | TransactionLocal(TransactionManager tm) Creates a transaction local variable. |
Method Summary | |
protected boolean | containsValue(Transaction tx) | public Object | get() Returns the value of this TransactionLocal variable associated with the
thread context transaction. | public Object | get(Transaction transaction) Returns the value of this TransactionLocal variable associated with the
specified transaction. | public Transaction | getTransaction() | protected Object | getValue(Transaction tx) get the transaction local value. | protected void | initDelegate() | protected Object | initialValue() Returns the initial value for this thransaction local. | public void | lock() | public void | lock(Transaction transaction) | public void | set(Object value) Sets the value of this TransactionLocal variable associtated with the
thread context transaction. | public void | set(Transaction transaction, Object value) Sets the value of this TransactionLocal variable associtated with the
specified transaction. | protected void | storeValue(Transaction tx, Object value) | public void | unlock() | public void | unlock(Transaction transaction) |
transactionManager | final protected TransactionManager transactionManager(Code) | | The transaction manager is maintained by the system and
manges the assocation of transaction to threads.
|
TransactionLocal | public TransactionLocal()(Code) | | Creates a thread local variable.
throws: IllegalStateException - if there is no system transaction manager |
TransactionLocal | public TransactionLocal(TransactionManager tm)(Code) | | Creates a transaction local variable. Using the given transaction manager
Parameters: tm - the transaction manager |
containsValue | protected boolean containsValue(Transaction tx)(Code) | | does Transaction contain object?
|
get | public Object get()(Code) | | 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.
the value of this TransactionLocal |
get | public Object get(Transaction transaction)(Code) | | 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.
Parameters: transaction - the transaction for which the variable it to be retrieved the value of this TransactionLocal throws: IllegalStateException - if an error occures while registeringa synchronization callback with the transaction |
getTransaction | public Transaction getTransaction()(Code) | | |
getValue | protected Object getValue(Transaction tx)(Code) | | get the transaction local value.
|
initDelegate | protected void initDelegate()(Code) | | Initialise the delegate
|
initialValue | protected Object initialValue()(Code) | | 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.
the initial value for this TransactionLocal |
lock | public void lock(Transaction transaction) throws InterruptedException(Code) | | Lock the TransactionLocal using the provided transaction
WARN: The current implemention just "locks the transactions"
Parameters: transaction - the transaction throws: IllegalStateException - if the transaction is not active throws: InterruptedException - if the thread is interrupted |
set | public void set(Object value)(Code) | | 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.
Parameters: value - the value to be associated with the thread context transactions's TransactionLocal |
set | public void set(Transaction transaction, Object value)(Code) | | 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.
Parameters: transaction - the transaction for which the value will be set Parameters: value - the value to be associated with the thread context transactions's TransactionLocal |
storeValue | protected void storeValue(Transaction tx, Object value)(Code) | | put the value in the TransactionImpl map
|
unlock | public void unlock()(Code) | | Unlock the TransactionLocal using the current transaction
|
unlock | public void unlock(Transaction transaction)(Code) | | Unlock the ThreadLocal using the provided transaction
Parameters: transaction - the transaction |
|
|
|