public class TransactionLocal extends Object
Modifier and Type | Field and Description |
---|---|
protected TransactionLocalDelegate |
delegate
The delegate
|
protected TransactionManager |
transactionManager
The transaction manager is maintained by the system and
manges the assocation of transaction to threads.
|
Constructor and Description |
---|
TransactionLocal()
Creates a thread local variable.
|
TransactionLocal(TransactionManager tm)
Creates a transaction local variable.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
containsValue(Transaction tx)
does Transaction contain object?
|
Object |
get()
Returns the value of this TransactionLocal variable associated with the
thread context transaction.
|
Object |
get(Transaction transaction)
Returns the value of this TransactionLocal variable associated with the
specified transaction.
|
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.
|
void |
lock()
Lock the TransactionLocal using the current transaction
|
void |
lock(Transaction transaction)
Lock the TransactionLocal using the provided transaction
|
void |
set(Object value)
Sets the value of this TransactionLocal variable associtated with the
thread context transaction.
|
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)
put the value in the TransactionImpl map
|
void |
unlock()
Unlock the TransactionLocal using the current transaction
|
void |
unlock(Transaction transaction)
Unlock the ThreadLocal using the provided transaction
|
protected final TransactionManager transactionManager
protected TransactionLocalDelegate delegate
public TransactionLocal()
IllegalStateException
- if there is no system transaction managerpublic TransactionLocal(TransactionManager tm)
tm
- the transaction managerpublic void lock() throws InterruptedException
WARN: The current implemention just "locks the transactions"
IllegalStateException
- if the transaction is not activeInterruptedException
- if the thread is interruptedpublic void lock(Transaction transaction) throws InterruptedException
WARN: The current implemention just "locks the transactions"
transaction
- the transactionIllegalStateException
- if the transaction is not activeInterruptedException
- if the thread is interruptedpublic void unlock()
public void unlock(Transaction transaction)
transaction
- the transactionprotected Object initialValue()
protected Object getValue(Transaction tx)
tx
- the transactionprotected void storeValue(Transaction tx, Object value)
tx
- the transactionvalue
- the valueprotected boolean containsValue(Transaction tx)
tx
- the transactionpublic Object get()
public Object get(Transaction transaction)
transaction
- the transaction for which the variable it to
be retrievedIllegalStateException
- if an error occures while registering
a synchronization callback with the transactionpublic void set(Object value)
value
- the value to be associated with the thread context
transactions's TransactionLocalpublic void set(Transaction transaction, Object value)
transaction
- the transaction for which the value will be setvalue
- the value to be associated with the thread context
transactions's TransactionLocalpublic Transaction getTransaction()
protected void initDelegate()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.