|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttyrex.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 domain| Method Detail |
public java.lang.String toString()
public javax.transaction.TransactionManager getTransactionManager()
TransactionDomainThe 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 TransactionDomainpublic javax.transaction.UserTransaction getUserTransaction()
TransactionDomainThe 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 TransactionDomainpublic org.omg.CosTransactions.TransactionFactory getTransactionFactory()
TransactionDomainThe 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 TransactionDomainpublic int getTransactionTimeout()
public boolean getNestedTransactions()
public void addInterceptor(TransactionInterceptor interceptor)
TransactionDomain
addInterceptor in class TransactionDomaininterceptor - The transaction interceptorpublic void removeInterceptor(TransactionInterceptor interceptor)
TransactionDomain
removeInterceptor in class TransactionDomaininterceptor - The transaction interceptorpublic void terminate()
TransactionDomain
terminate in class TransactionDomainpublic DomainMetrics getDomainMetrics()
TransactionDomain
getDomainMetrics in class TransactionDomainpublic java.lang.String getDomainName()
TransactionDomain
getDomainName in class TransactionDomainpublic Resources getResources()
TransactionDomainInitially 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 TransactionDomainpublic 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 TransactionDomainRecoveryException - A chain of errors reported during recoverypublic int getTotalCommitted()
DomainMetrics
getTotalCommitted in interface DomainMetricspublic int getTotalRolledback()
DomainMetrics
getTotalRolledback in interface DomainMetricspublic float getAvgDuration()
DomainMetrics
getAvgDuration in interface DomainMetricspublic int getActive()
DomainMetrics
getActive in interface DomainMetricspublic void reset()
DomainMetrics
reset in interface DomainMetricspublic 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 transactions
protected 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,
PropagationContextprotected 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 timeout
protected void setTransactionTimeout(TransactionImpl tx,
int timeout)
tx - The transactiontimeout - The new timeout in seconds, zero to use the
default timeout for all new transactions.setTransactionTimeoutprotected 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.RollbackExceptionprotected 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 threadenlistThreadpublic 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 | ||||||||