|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jrunx.tyrex.tm.TransactionDomain
|
+--jrunx.tyrex.tm.impl.TransactionDomainImpl
Implementation of a transaction domain.
| Field Summary | |
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 jrunx.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 jrunx.tyrex.tm.impl.TransactionImpl |
createTransaction(jrunx.tyrex.tm.impl.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(jrunx.tyrex.tm.impl.TransactionImpl tx,
ThreadContext context,
java.lang.Thread thread)
Called to associate the transaction with the thread. |
jrunx.tyrex.tm.impl.TransactionImpl |
findTransaction(java.lang.String xid)
|
jrunx.tyrex.tm.impl.TransactionImpl |
findTransaction(javax.transaction.xa.Xid xid)
|
protected void |
forgetTransaction(jrunx.tyrex.tm.impl.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()
|
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(jrunx.tyrex.tm.impl.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(jrunx.tyrex.tm.impl.TransactionImpl tx)
|
protected void |
notifyCompletion(jrunx.tyrex.tm.impl.TransactionImpl tx,
int heuristic)
|
protected void |
notifyRollback(jrunx.tyrex.tm.impl.TransactionImpl tx)
|
void |
recover()
Called to initiate recovery. |
protected jrunx.tyrex.tm.impl.TransactionImpl |
recreateTransaction(org.omg.CosTransactions.PropagationContext pgContext)
Creates a new transaction to represent a remote OTS transaction, but does not activate it yet. |
protected jrunx.tyrex.tm.impl.TransactionImpl |
recreateTransaction(TransactionContext trCtx)
Creates a new transaction to represent a remote 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(jrunx.tyrex.tm.impl.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 jrunx.tyrex.tm.TransactionDomain |
logError |
| 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 Journal _journal
| Constructor Detail |
public TransactionDomainImpl(DomainConfig config)
throws DomainConfigurationException
config - The domain configuration objectDomainConfigurationException - Failed to create the transaction domain| Method Detail |
public java.lang.String toString()
toString in class java.lang.Objectpublic 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 TransactionDomainjrunx.tyrex.tm.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 TransactionDomainjrunx.tyrex.tm.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 TransactionDomainjrunx.tyrex.tm.TransactionDomainpublic int getTransactionTimeout()
public boolean getNestedTransactions()
public void addInterceptor(TransactionInterceptor interceptor)
TransactionDomainaddInterceptor in class TransactionDomainjrunx.tyrex.tm.TransactionDomaininterceptor - The transaction interceptorpublic void removeInterceptor(TransactionInterceptor interceptor)
TransactionDomainremoveInterceptor in class TransactionDomainjrunx.tyrex.tm.TransactionDomaininterceptor - The transaction interceptorpublic void terminate()
TransactionDomainterminate in class TransactionDomainpublic DomainMetrics getDomainMetrics()
TransactionDomaingetDomainMetrics in class TransactionDomainjrunx.tyrex.tm.TransactionDomainpublic java.lang.String getDomainName()
TransactionDomaingetDomainName in class TransactionDomainjrunx.tyrex.tm.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 TransactionDomainjrunx.tyrex.tm.TransactionDomain
public void recover()
throws RecoveryException
TransactionDomainrecover in class TransactionDomainjrunx.tyrex.tm.TransactionDomainRecoveryException - A chain of errors reported during recoverypublic int getTotalCommitted()
DomainMetricsgetTotalCommitted in interface DomainMetricsjrunx.tyrex.tm.DomainMetricspublic int getTotalRolledback()
DomainMetricsgetTotalRolledback in interface DomainMetricsjrunx.tyrex.tm.DomainMetricspublic float getAvgDuration()
DomainMetricsgetAvgDuration in interface DomainMetricsjrunx.tyrex.tm.DomainMetricspublic int getActive()
DomainMetricsgetActive in interface DomainMetricsjrunx.tyrex.tm.DomainMetricspublic void reset()
DomainMetricsreset in interface DomainMetricspublic jrunx.tyrex.tm.impl.TransactionImpl findTransaction(javax.transaction.xa.Xid xid)
public jrunx.tyrex.tm.impl.TransactionImpl findTransaction(java.lang.String xid)
public TransactionDomainImpl getNextDomain()
public void setNextDomain(TransactionDomainImpl nextDomain)
protected jrunx.tyrex.tm.impl.TransactionImpl createTransaction(jrunx.tyrex.tm.impl.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 secondsjavax.transaction.SystemException - Reached the quota for new transactions
protected jrunx.tyrex.tm.impl.TransactionImpl recreateTransaction(TransactionContext trCtx)
throws javax.transaction.SystemException
SystemException if we have reached the quota for new
transactions or the server has not been started.
pgContext - The OTS propagation contextjavax.transaction.SystemException - Reached the quota for new transactions,
or a transaction with the same identifier already existsTransactionFactoryImpl,
PropagationContext
protected jrunx.tyrex.tm.impl.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 contextjavax.transaction.SystemException - Reached the quota for new transactions,
or a transaction with the same identifier already existsTransactionFactoryImpl,
PropagationContextprotected void forgetTransaction(jrunx.tyrex.tm.impl.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(jrunx.tyrex.tm.impl.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(jrunx.tyrex.tm.impl.TransactionImpl tx)
ControlImpl to obtain the timeout on a
transaction for the purpose of the propagation context.tx - The transaction
protected void notifyCompletion(jrunx.tyrex.tm.impl.TransactionImpl tx,
int heuristic)
protected void notifyCommit(jrunx.tyrex.tm.impl.TransactionImpl tx)
throws javax.transaction.RollbackException
protected void notifyRollback(jrunx.tyrex.tm.impl.TransactionImpl tx)
protected javax.transaction.Transaction[] listTransactions()
protected void dumpTransactionList(java.io.PrintWriter writer)
protected boolean enlistThread(jrunx.tyrex.tm.impl.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)
tx - The transactioncontext - 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||