|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tyrex.tm.TransactionDomain tyrex.tm.impl.TransactionDomainImpl
Implementation of a transaction domain.
Field Summary | |
protected Category |
_category
The log4J category for this transaction domain. |
protected Journal |
_journal
The transaction journal used by this domain. |
protected org.omg.CORBA.ORB |
_orb
The CORBA ORB used by this transaction domain, or null if no CORBA ORB is used. |
protected TransactionManagerImpl |
_txManager
A singleton transaction manager implementation. |
static int |
TABLE_SIZE
The size of the hash table. |
Fields inherited from class tyrex.tm.TransactionDomain |
ACTIVE, READY, RECOVERING, TERMINATED |
Constructor Summary | |
TransactionDomainImpl(DomainConfig config)
Constructs a new transaction domain. |
Method Summary | |
void |
addInterceptor(TransactionInterceptor interceptor)
Adds a transaction interceptor to this transaction domain. |
protected TransactionImpl |
createTransaction(TransactionImpl parent,
long timeout)
Creates a new transaction. |
protected void |
delistThread(ThreadContext context,
java.lang.Thread thread)
Called to dissociatethe transaction from the thread. |
protected void |
dumpTransactionList(java.io.PrintWriter writer)
|
protected boolean |
enlistThread(TransactionImpl tx,
ThreadContext context,
java.lang.Thread thread)
Called to associate the transaction with the thread. |
TransactionImpl |
findTransaction(java.lang.String xid)
|
TransactionImpl |
findTransaction(javax.transaction.xa.Xid xid)
|
protected void |
forgetTransaction(TransactionImpl tx)
Called by forget to forget about
the transaction once it has been commited/rolledback. |
int |
getActive()
Returns the current number of active transactions. |
float |
getAvgDuration()
Returns the average duration for active transactions. |
DomainMetrics |
getDomainMetrics()
Returns the transaction domain metrics. |
java.lang.String |
getDomainName()
Returns the transaction domain name. |
boolean |
getNestedTransactions()
|
TransactionDomainImpl |
getNextDomain()
|
Resources |
getResources()
Returns resources installed for this transaction domain. |
int |
getState()
Returns the transaction domain state. |
int |
getTotalCommitted()
Returns the total number of committed transactions. |
int |
getTotalRolledback()
Returns the total number of rolled back transactions. |
org.omg.CosTransactions.TransactionFactory |
getTransactionFactory()
Returns an OTS transaction factory for this transaction domain. |
javax.transaction.TransactionManager |
getTransactionManager()
Returns a transaction manager for this transaction domain. |
int |
getTransactionTimeout()
|
protected int |
getTransactionTimeout(TransactionImpl tx)
Called by ControlImpl to obtain the timeout on a
transaction for the purpose of the propagation context. |
javax.transaction.UserTransaction |
getUserTransaction()
Returns a user transaction for this transaction domain. |
void |
identifyORB(org.omg.CORBA.ORB orb,
org.omg.CORBA.TSIdentification tsi,
java.util.Properties prop)
|
protected javax.transaction.Transaction[] |
listTransactions()
|
protected void |
notifyCommit(TransactionImpl tx)
|
protected void |
notifyCompletion(TransactionImpl tx,
int heuristic)
|
protected void |
notifyRollback(TransactionImpl tx)
|
void |
recover()
Called to initiate recovery. |
protected TransactionImpl |
recreateTransaction(org.omg.CosTransactions.PropagationContext pgContext)
Creates a new transaction to represent a remote OTS transaction, but does not activate it yet. |
void |
removeInterceptor(TransactionInterceptor interceptor)
Removes a transaction interceptor to this transaction domain. |
void |
reset()
Called to reset this metrics object. |
void |
run()
Background thread that looks for transactions that have timed out and terminates them. |
void |
setNextDomain(TransactionDomainImpl nextDomain)
|
protected void |
setTransactionTimeout(int timeout)
Called to set the timeout of all transactions created from this domain. |
protected void |
setTransactionTimeout(TransactionImpl tx,
int timeout)
Called to change the timeout of the transaction and all the resources enlisted with that transaction. |
void |
terminate()
Terminates the transaction domain. |
java.lang.String |
toString()
|
Methods inherited from class tyrex.tm.TransactionDomain |
createDomain, createDomain, createDomain, getDomain, getTransaction, getTransaction |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int TABLE_SIZE
protected final TransactionManagerImpl _txManager
protected org.omg.CORBA.ORB _orb
protected final Category _category
protected final Journal _journal
Constructor Detail |
public TransactionDomainImpl(DomainConfig config) throws DomainConfigurationException
config
- The domain configuration object
DomainConfigurationException
- Failed to create the transaction domainMethod Detail |
public java.lang.String toString()
public javax.transaction.TransactionManager getTransactionManager()
TransactionDomain
The transaction managed can be used to begin, commit and rollback transactions in this domain only.
Calling this method multiple times will return the same instance of the transaction manager.
getTransactionManager
in class TransactionDomain
public javax.transaction.UserTransaction getUserTransaction()
TransactionDomain
The user transaction can be used to begin, commit and rollback transactions in this domain only.
Calling this method multiple times will return the same instance of the user transaction.
getUserTransaction
in class TransactionDomain
public org.omg.CosTransactions.TransactionFactory getTransactionFactory()
TransactionDomain
The transaction factory can be used to create and re-create OTS transactions in this domain only. It is also used to identify the ORB by implementing TransactionService.
Calling this method multiple times will return the same instance of the transaction factory.
getTransactionFactory
in class TransactionDomain
public int getTransactionTimeout()
public boolean getNestedTransactions()
public void addInterceptor(TransactionInterceptor interceptor)
TransactionDomain
addInterceptor
in class TransactionDomain
interceptor
- The transaction interceptorpublic void removeInterceptor(TransactionInterceptor interceptor)
TransactionDomain
removeInterceptor
in class TransactionDomain
interceptor
- The transaction interceptorpublic void terminate()
TransactionDomain
terminate
in class TransactionDomain
public DomainMetrics getDomainMetrics()
TransactionDomain
getDomainMetrics
in class TransactionDomain
public java.lang.String getDomainName()
TransactionDomain
getDomainName
in class TransactionDomain
public Resources getResources()
TransactionDomain
Initially the resource list is based on resources defined in the domain configuration file. This method can be used to add new resources or disable existing resources.
getResources
in class TransactionDomain
public int getState()
TransactionDomain
The initial state for a transaction domain is TransactionDomain.READY
. The domain
transitions to TransactionDomain.ACTIVE
after recovery has completed by calling
recover
.
The domain transitions to TransactionDomain.TERMINATED
after it has been terminated
by calling terminate
.
getState
in class TransactionDomain
public void recover() throws RecoveryException
TransactionDomain
recover
in class TransactionDomain
RecoveryException
- A chain of errors reported during recoverypublic int getTotalCommitted()
DomainMetrics
getTotalCommitted
in interface DomainMetrics
public int getTotalRolledback()
DomainMetrics
getTotalRolledback
in interface DomainMetrics
public float getAvgDuration()
DomainMetrics
getAvgDuration
in interface DomainMetrics
public int getActive()
DomainMetrics
getActive
in interface DomainMetrics
public void reset()
DomainMetrics
reset
in interface DomainMetrics
public TransactionImpl findTransaction(javax.transaction.xa.Xid xid)
public TransactionImpl findTransaction(java.lang.String xid)
public TransactionDomainImpl getNextDomain()
public void setNextDomain(TransactionDomainImpl nextDomain)
protected TransactionImpl createTransaction(TransactionImpl parent, long timeout) throws javax.transaction.SystemException
SystemException
if
we have reached the quota for new transactions or active
transactions, or the server has not been started.
parent
- The parent transactiontimeout
- The default timeout for the new transaction,
specified in seconds
javax.transaction.SystemException
- Reached the quota for new transactionsprotected TransactionImpl recreateTransaction(org.omg.CosTransactions.PropagationContext pgContext) throws javax.transaction.SystemException
SystemException
if we have reached the quota for new
transactions or the server has not been started.
The newly created transaction will have a non-native Xid, therefore it cannot be distributed across two machines using the RMI interface but only through OTS propagation context.
pgContext
- The OTS propagation context
javax.transaction.SystemException
- Reached the quota for new transactions,
or a transaction with the same identifier already existsTransactionFactoryImpl
,
PropagationContext
protected void forgetTransaction(TransactionImpl tx)
forget
to forget about
the transaction once it has been commited/rolledback.
The transaction will no longer be available to findTransaction
. The transaction's association and global identifier
are forgotten as well as all thread associated with it.
Subsequent calls to findTransaction
and getControl
will not be able to locate the
transaction.
If this is the last transaction in a terminating domain, the domain will close some of its resources (e.g. journal) after this method returns.
tx
- The transaction to forget aboutprotected void setTransactionTimeout(int timeout)
timeout
- The new timeout in seconds, zero to restore the
default timeoutprotected void setTransactionTimeout(TransactionImpl tx, int timeout)
tx
- The transactiontimeout
- The new timeout in seconds, zero to use the
default timeout for all new transactions.setTransactionTimeout
protected int getTransactionTimeout(TransactionImpl tx)
ControlImpl
to obtain the timeout on a
transaction for the purpose of the propagation context.
tx
- The transaction
protected void notifyCompletion(TransactionImpl tx, int heuristic)
protected void notifyCommit(TransactionImpl tx) throws javax.transaction.RollbackException
javax.transaction.RollbackException
protected void notifyRollback(TransactionImpl tx)
protected javax.transaction.Transaction[] listTransactions()
protected void dumpTransactionList(java.io.PrintWriter writer)
protected boolean enlistThread(TransactionImpl tx, ThreadContext context, java.lang.Thread thread)
tx
- The transactioncontext
- The thread contextthread
- The thread
protected void delistThread(ThreadContext context, java.lang.Thread thread)
context
- The thread contextthread
- The threadenlistThread
public void run()
This thread is terminated by interrupting it. This thread synchronizes on itself (thread instance) to be notified of a changed in the next timeout.
run
in interface java.lang.Runnable
public void identifyORB(org.omg.CORBA.ORB orb, org.omg.CORBA.TSIdentification tsi, java.util.Properties prop)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |