[jboss-svn-commits] JBL Code SVN: r5214 - in labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator atsintegration/classes/com/arjuna/ats/jbossatx/jta
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 21 07:43:29 EDT 2006
Author: kevin.conner at jboss.com
Date: 2006-07-21 07:43:21 -0400 (Fri, 21 Jul 2006)
New Revision: 5214
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/AtomicAction.java
labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java
labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java
labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
Log:
Fix for JTA TransactionManagerService/transaction timeout
Modified: labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/AtomicAction.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/AtomicAction.java 2006-07-21 11:42:48 UTC (rev 5213)
+++ labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/AtomicAction.java 2006-07-21 11:43:21 UTC (rev 5214)
@@ -55,7 +55,7 @@
public class AtomicAction extends TwoPhaseCoordinator
{
- public static final int NO_TIMEOUT = 0;
+ public static final int NO_TIMEOUT = -1;
/**
* Create a new transaction. If there is already a transaction associated
@@ -140,6 +140,9 @@
_timeout = timeout;
+ if (_timeout == 0)
+ _timeout = TxControl.getDefaultTimeout();
+
if (_timeout > AtomicAction.NO_TIMEOUT)
TransactionReaper.transactionReaper(true).insert(this, _timeout);
Modified: labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java 2006-07-21 11:42:48 UTC (rev 5213)
+++ labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java 2006-07-21 11:43:21 UTC (rev 5214)
@@ -79,6 +79,7 @@
* <li> OBJECTSTORE_HIERARCHY_TIMEOUT = com.arjuna.ats.arjuna.objectstore.hierarchyTimeout
* <li> RECOVERY_MANAGER_PORT = com.arjuna.ats.internal.arjuna.recovery.recoveryPort
* <li> XA_NODE_IDENTIFIER = com.arjuna.ats.arjuna.xa.nodeIdentifier
+ * <li> DEFAULT_TIMEOUT = com.arjuna.ats.arjuna.coordinator.defaultTimeout
* </ul>
*
* @author Mark Little (mark at arjuna.com)
@@ -132,6 +133,7 @@
public static final String OBJECTSTORE_HIERARCHY_TIMEOUT = "com.arjuna.ats.arjuna.objectstore.hierarchyTimeout";
public static final String RECOVERY_MANAGER_PORT = "com.arjuna.ats.internal.arjuna.recovery.recoveryPort";
public static final String XA_NODE_IDENTIFIER = "com.arjuna.ats.arjuna.xa.nodeIdentifier";
+ public static final String DEFAULT_TIMEOUT = "com.arjuna.ats.arjuna.coordinator.defaultTimeout";
}
Modified: labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java 2006-07-21 11:42:48 UTC (rev 5213)
+++ labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java 2006-07-21 11:43:21 UTC (rev 5214)
@@ -56,6 +56,16 @@
public class TxControl
{
+ public static final int getDefaultTimeout ()
+ {
+ return _defaultTimeout;
+ }
+
+ public static final void setDefaultTimeout (int timeout)
+ {
+ _defaultTimeout = timeout;
+ }
+
public static final void enable ()
{
TxControl.enable = true;
@@ -156,10 +166,26 @@
static TransactionStatusManager transactionStatusManager = null;
static ClassName actionStoreType = null;
static byte[] xaNodeName = null;
+ static int _defaultTimeout = 60000; // 60 seconds
static
{
- String env = arjPropertyManager.propertyManager.getProperty(Environment.MAINTAIN_HEURISTICS);
+ String env = arjPropertyManager.propertyManager.getProperty(Environment.DEFAULT_TIMEOUT);
+
+ if (env != null)
+ {
+ try
+ {
+ Integer in = new Integer(env);
+ _defaultTimeout = in.intValue();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ env = arjPropertyManager.propertyManager.getProperty(Environment.MAINTAIN_HEURISTICS);
if (env != null)
{
Modified: labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2006-07-21 11:42:48 UTC (rev 5213)
+++ labs/jbosstm/branches/JBOSSTS_4_2_GA_MP2/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2006-07-21 11:43:21 UTC (rev 5214)
@@ -42,6 +42,7 @@
import com.arjuna.ats.jta.common.Environment;
import com.arjuna.ats.jta.common.jtaPropertyManager;
import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.coordinator.TxControl;
import com.arjuna.ats.arjuna.coordinator.TxStats;
import com.arjuna.ats.internal.tsmx.mbeans.PropertyServiceJMXPlugin;
@@ -74,9 +75,7 @@
private static final JBossXATerminator TERMINATOR = new XATerminator() ;
private RecoveryManagerImple _recoveryManager;
- private boolean _initialised = false;
private boolean _runRM = true;
- private int _transactionTimeout = -1;
/**
* Use the short class name as the default for the service name.
@@ -158,19 +157,6 @@
jtaPropertyManager.propertyManager.setProperty(Environment.JTA_UT_IMPLEMENTATION, UserTransactionImple.class.getName());
JNDIManager.bindJTATransactionManagerImplementation();
-
- /** Signal that the transaction manager has been bound **/
- _initialised = true;
-
- /**
- * If a call to set transaction has been called before the transaction
- * manager is bound then set the transaction timeout now
- */
- if (_transactionTimeout != -1)
- {
- this.getLog().info("Transaction timeout set to " + _transactionTimeout);
- setTransactionTimeout(_transactionTimeout);
- }
}
private boolean isRecoveryManagerRunning() throws Exception
@@ -268,19 +254,10 @@
*/
public void setTransactionTimeout(int timeout) throws javax.transaction.SystemException
{
- if (_initialised)
- {
- javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
-
- tm.setTransactionTimeout(timeout);
- }
+ if (timeout > 0)
+ TxControl.setDefaultTimeout(timeout);
else
- {
- if (timeout > 0)
- _transactionTimeout = timeout;
- else
- throw new javax.transaction.SystemException("Transaction Timeout < 0");
- }
+ throw new javax.transaction.SystemException("Transaction Timeout < 0");
}
/**
More information about the jboss-svn-commits
mailing list