[jboss-svn-commits] JBL Code SVN: r20561 - in labs/jbosstm/trunk: atsintegration/classes/com/arjuna/ats/jbossatx/jta and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 17 08:34:31 EDT 2008
Author: jhalliday
Date: 2008-06-17 08:34:31 -0400 (Tue, 17 Jun 2008)
New Revision: 20561
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java
Log:
Updated JBossAS integration so that the TransactionService exposes all available transaction stats thru JMX, not just a subset of them. Tweaked the reaper so we actually collect timeout stats, 'cause reporting them is not practical otherwise. http://jira.jboss.com/jira/browse/JBTM-304
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java 2008-06-17 12:01:22 UTC (rev 20560)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java 2008-06-17 12:34:31 UTC (rev 20561)
@@ -73,7 +73,7 @@
* TransactionReaper::check interrupting cancel in progress for {0}
* @message com.arjuna.ats.arjuna.coordinator.TransactionReaper_5
* [com.arjuna.ats.arjuna.coordinator.TransactionReaper_5] -
- * TransactionReaper::check worker zombie count {0] exceeds specified limit
+ * TransactionReaper::check worker zombie count {0] exceeds specified limit
* @message com.arjuna.ats.arjuna.coordinator.TransactionReaper_6
* [com.arjuna.ats.arjuna.coordinator.TransactionReaper_6] -
* TransactionReaper::check worker {0} not responding to interrupt when cancelling TX {1} -- worker marked as zombie and TX scheduled for mark-as-rollback
@@ -363,7 +363,7 @@
DebugLevel.FUNCTIONS,
VisibilityLevel.VIS_PUBLIC,
FacilityCode.FAC_ATOMIC_ACTION,
- "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_4",
+ "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_4",
new Object[]{e._control.get_uid()});
}
}
@@ -403,7 +403,7 @@
DebugLevel.ERROR_MESSAGES,
VisibilityLevel.VIS_PUBLIC,
FacilityCode.FAC_ATOMIC_ACTION,
- "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_5",
+ "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_5",
new Object[]{new Integer(_zombieCount)});
}
}
@@ -423,7 +423,7 @@
DebugLevel.ERROR_MESSAGES,
VisibilityLevel.VIS_PUBLIC,
FacilityCode.FAC_ATOMIC_ACTION,
- "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_6",
+ "com.arjuna.ats.internal.arjuna.coordinator.ReaperThread_6",
new Object[]{e._worker,
e._control.get_uid()});
}
@@ -508,7 +508,7 @@
}
}
} while(true) ;
-
+
return true;
}
@@ -575,15 +575,21 @@
try
{
- if (e._control.running()) {
+ if (e._control.running()) {
- // try to cancel the transaction
+ // try to cancel the transaction
- if (e._control.cancel() == ActionStatus.ABORTED)
- {
- cancelled = true;
- }
- }
+ if (e._control.cancel() == ActionStatus.ABORTED)
+ {
+ cancelled = true;
+
+ if (TxControl.enableStatistics) {
+ // note that we also count timeouts as application rollbacks via
+ // the stats unpdate in the TwoPhaseCoordinator cancel() method.
+ TxStats.incrementTimeouts();
+ }
+ }
+ }
}
catch (Exception e1)
{
@@ -883,11 +889,11 @@
/**
* Given the transaction instance, this will return the time left before the
* transaction is automatically rolled back if it has not been terminated.
- *
+ *
* @param control
* @return the remaining time in seconds.
*/
-
+
public final int getRemainingTimeout (Object control)
{
if ((_transactions.size() == 0) || (control == null))
@@ -906,21 +912,21 @@
final ReaperElement reaperElement = (ReaperElement)_timeouts.get(control);
final Integer timeout;
-
- if (reaperElement == null)
+
+ if (reaperElement == null)
{
timeout = new Integer(0);
- }
+ }
else
{
// units are in milliseconds at this stage.
-
+
long remainingTime = reaperElement._absoluteTimeout - System.currentTimeMillis();
double timeInSeconds = Math.ceil(remainingTime/1000.0); // round up.
-
+
if (timeInSeconds <= 0)
timeInSeconds = 1;
-
+
timeout = new Integer((int) remainingTime/1000); // convert back to seconds.
}
@@ -935,7 +941,7 @@
return timeout.intValue();
}
-
+
/**
* Given a Control, return the associated timeout, or 0 if we do not know
* about it.
@@ -1057,7 +1063,7 @@
{
TransactionReaper._theReaper._cancelWaitPeriod = defaultCancelWaitPeriod;
}
-
+
String cancelFailWait = arjPropertyManager.propertyManager
.getProperty(Environment.TX_REAPER_CANCEL_FAIL_WAIT_PERIOD);
if (cancelFailWait != null)
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2008-06-17 12:01:22 UTC (rev 20560)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2008-06-17 12:34:31 UTC (rev 20561)
@@ -31,9 +31,7 @@
package com.arjuna.ats.jbossatx.jta;
import org.jboss.system.server.ServerConfig;
-import org.jboss.tm.JBossXATerminator;
-import org.jboss.tm.LastResource;
-import org.jboss.tm.XAExceptionFormatter;
+import org.jboss.tm.*;
import org.jboss.logging.Logger;
@@ -415,8 +413,8 @@
}
/**
- * Returns the number of active transactions
- * @return The number of active transactions.
+ * Returns the total number of transactions started over the lifetime of the server
+ * @return Returns the total number of transactions started over the lifetime of the server
*/
public long getTransactionCount()
{
@@ -424,6 +422,22 @@
}
/**
+ * Returns the total number of nested transactions started over the lifetime of the server.
+ * This will usually be 0 even when stats are enabled, since JTA disallows nested tx by default.
+ */
+ public long getNestedTransactonCount() {
+ return TxStats.numberOfNestedTransactions();
+ }
+
+ /**
+ * Returns the number of heuristics that have occurred.
+ * @return the number of heuristics that have occurred.
+ */
+ public long getHeuristicCount() {
+ return TxStats.numberOfHeuristics();
+ }
+
+ /**
* Returns the number of committed transactions
* @return The number of committed transactions.
*/
@@ -442,6 +456,40 @@
}
/**
+ * Get the number of transactions that have begun but not yet terminated.
+ * This count is approximate, particularly in recovery situations.
+ */
+ public long getRunningTransactionCount() {
+ return TxStats.numberOfInflightTransactions();
+ }
+
+ /**
+ * Returns the number of transactions that have been timed out by the transaction reaper.
+ * @return the number of transactions that have been timed out by the transaction reaper.
+ */
+ public long getTimedoutCount() {
+ return TxStats.numberOfTimedOutTransactions();
+ }
+
+ /**
+ * Returns the number of transactions that have been rolled back by application request.
+ * This includes those that timeout, since the timeout behaviour is considered an
+ * attribute of the application configuration.
+ * @return the number of transactions that have been rolled back by application request.
+ */
+ public long getApplicationRollbackCount() {
+ return TxStats.numberOfApplicationRollbacks();
+ }
+
+ /**
+ * Returns the number of transactions that rolled back due to resource failure.
+ * @return the number of transactions that rolled back due to resource failure.
+ */
+ public long getResourceRollbackCount() {
+ return TxStats.numberOfResourceRollbacks();
+ }
+
+ /**
* Set whether the recovery manager should be ran in the same VM as
* JBoss. If this is false the Recovery Manager is already expected to
* be running when JBoss starts.
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java 2008-06-17 12:01:22 UTC (rev 20560)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java 2008-06-17 12:34:31 UTC (rev 20561)
@@ -124,24 +124,65 @@
public void unregisterXAExceptionFormatter(Class c);
/**
- * Returns the number of active transactions
- * @return
+ * Returns the total number of transactions started over the lifetime of the server
+ * @return the total number of transactions started over the lifetime of the server
*/
public long getTransactionCount();
/**
+ * Returns the total number of nested transactions started over the lifetime of the server.
+ * This will usually be 0 even when stats are enabled, since JTA disallows nested tx by default.
+ * @return the total number of nested transactions started over the lifetime of the server.
+ */
+ public long getNestedTransactonCount();
+
+ /**
+ * Returns the number of heuristics that have occurred.
+ * @return the number of heuristics that have occurred.
+ */
+ public long getHeuristicCount();
+
+ /**
* Returns the number of committed transactions
- * @return
+ * @return the number of committed transactions
*/
public long getCommitCount();
/**
- * Returns the number of rolledback transactions
+ * Returns the number of rolledback transactions.
+ * This is approximatly the same as applicationRollbackCount + ResourceRollbackCount.
* @return
*/
public long getRollbackCount();
/**
+ * Returns the number of transactions that have begun but not yet terminated.
+ * This count is approximate, particularly in recovery situations.
+ * @return the number of transactions that have begun but not yet terminated.
+ */
+ public long getRunningTransactionCount();
+
+ /**
+ * Returns the number of transactions that have been timed out by the transaction reaper.
+ * @return the number of transactions that have been timed out by the transaction reaper.
+ */
+ public long getTimedoutCount();
+
+ /**
+ * Returns the number of transactions that have been rolled back by application request.
+ * This includes those that timeout, since the timeout behaviour is considered an
+ * attribute of the application configuration.
+ * @return the number of transactions that have been rolled back by application request.
+ */
+ public long getApplicationRollbackCount();
+
+ /**
+ * Returns the number of transactions that rolled back due to resource failure.
+ * @return the number of transactions that rolled back due to resource failure.
+ */
+ public long getResourceRollbackCount();
+
+ /**
* Set whether the recovery manager should be ran in the same VM as
* JBoss. If this is false the Recovery Manager is already expected to
* be running when JBoss starts.
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java 2008-06-17 12:01:22 UTC (rev 20560)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java 2008-06-17 12:34:31 UTC (rev 20561)
@@ -453,8 +453,8 @@
}
/**
- * Returns the number of active transactions
- * @return The number of active transactions.
+ * Returns the total number of transactions started over the lifetime of the server
+ * @return Returns the total number of transactions started over the lifetime of the server
*/
public long getTransactionCount()
{
@@ -462,6 +462,22 @@
}
/**
+ * Returns the total number of nested transactions started over the lifetime of the server.
+ * This will usually be 0 even when stats are enabled, since JTA disallows nested tx by default.
+ */
+ public long getNestedTransactonCount() {
+ return TxStats.numberOfNestedTransactions();
+ }
+
+ /**
+ * Returns the number of heuristics that have occurred.
+ * @return the number of heuristics that have occurred.
+ */
+ public long getHeuristicCount() {
+ return TxStats.numberOfHeuristics();
+ }
+
+ /**
* Returns the number of committed transactions
* @return The number of committed transactions.
*/
@@ -480,6 +496,40 @@
}
/**
+ * Get the number of transactions that have begun but not yet terminated.
+ * This count is approximate, particularly in recovery situations.
+ */
+ public long getRunningTransactionCount() {
+ return TxStats.numberOfInflightTransactions();
+ }
+
+ /**
+ * Returns the number of transactions that have been timed out by the transaction reaper.
+ * @return the number of transactions that have been timed out by the transaction reaper.
+ */
+ public long getTimedoutCount() {
+ return TxStats.numberOfTimedOutTransactions();
+ }
+
+ /**
+ * Returns the number of transactions that have been rolled back by application request.
+ * This includes those that timeout, since the timeout behaviour is considered an
+ * attribute of the application configuration.
+ * @return the number of transactions that have been rolled back by application request.
+ */
+ public long getApplicationRollbackCount() {
+ return TxStats.numberOfApplicationRollbacks();
+ }
+
+ /**
+ * Returns the number of transactions that rolled back due to resource failure.
+ * @return the number of transactions that rolled back due to resource failure.
+ */
+ public long getResourceRollbackCount() {
+ return TxStats.numberOfResourceRollbacks();
+ }
+
+ /**
* Set whether the recovery manager should be ran in the same VM as
* JBoss. If this is false the Recovery Manager is already expected to
* be running when JBoss starts.
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java 2008-06-17 12:01:22 UTC (rev 20560)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java 2008-06-17 12:34:31 UTC (rev 20561)
@@ -50,7 +50,7 @@
* @param timeout The default timeout in seconds for all transactions created
* using this transaction manager.
*
- * @throws IllegalStateException if the mbean has already started.
+ * @throws IllegalStateException if the MBean has already started.
*/
public void setTransactionTimeout(int timeout) throws IllegalStateException ;
@@ -123,24 +123,65 @@
public void unregisterXAExceptionFormatter(Class c);
/**
- * Returns the number of active transactions
- * @return
+ * Returns the total number of transactions started over the lifetime of the server
+ * @return the total number of transactions started over the lifetime of the server
*/
public long getTransactionCount();
/**
+ * Returns the total number of nested transactions started over the lifetime of the server.
+ * This will usually be 0 even when stats are enabled, since JTA disallows nested tx by default.
+ * @return the total number of nested transactions started over the lifetime of the server.
+ */
+ public long getNestedTransactonCount();
+
+ /**
+ * Returns the number of heuristics that have occurred.
+ * @return the number of heuristics that have occurred.
+ */
+ public long getHeuristicCount();
+
+ /**
* Returns the number of committed transactions
- * @return
+ * @return the number of committed transactions
*/
public long getCommitCount();
/**
- * Returns the number of rolledback transactions
+ * Returns the number of rolledback transactions.
+ * This is approximatly the same as applicationRollbackCount + ResourceRollbackCount.
* @return
*/
public long getRollbackCount();
/**
+ * Returns the number of transactions that have begun but not yet terminated.
+ * This count is approximate, particularly in recovery situations.
+ * @return the number of transactions that have begun but not yet terminated.
+ */
+ public long getRunningTransactionCount();
+
+ /**
+ * Returns the number of transactions that have been timed out by the transaction reaper.
+ * @return the number of transactions that have been timed out by the transaction reaper.
+ */
+ public long getTimedoutCount();
+
+ /**
+ * Returns the number of transactions that have been rolled back by application request.
+ * This includes those that timeout, since the timeout behaviour is considered an
+ * attribute of the application configuration.
+ * @return the number of transactions that have been rolled back by application request.
+ */
+ public long getApplicationRollbackCount();
+
+ /**
+ * Returns the number of transactions that rolled back due to resource failure.
+ * @return the number of transactions that rolled back due to resource failure.
+ */
+ public long getResourceRollbackCount();
+
+ /**
* Set whether the recovery manager should be ran in the same VM as
* JBoss. If this is false the Recovery Manager is already expected to
* be running when JBoss starts.
@@ -163,7 +204,7 @@
* Set the object store directory.
* @param objectStoreDir The object store directory.
*
- * @throws IllegalStateException if the MBean has already started
+ * @throws IllegalStateException if the MBean has already started.
*/
public void setObjectStoreDir(final String objectStoreDir) throws IllegalStateException ;
More information about the jboss-svn-commits
mailing list