[hornetq-commits] JBoss hornetq SVN: r8021 - in trunk: src/main/org/hornetq/core/config/impl and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 1 04:27:04 EDT 2009


Author: jmesnil
Date: 2009-10-01 04:27:04 -0400 (Thu, 01 Oct 2009)
New Revision: 8021

Modified:
   trunk/docs/user-manual/en/transaction-config.xml
   trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
   trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
   trunk/tests/src/org/hornetq/tests/integration/xa/XaTimeoutTest.java
Log:
HORNETQ-106: reenable transaction timeouts

* in ResourceManagerImpl, reenabled timeouts to rollback *unprepared* transaction branches
  - timeout is computed against the branch creation time (as specified in OTS)
* changed default transaction timeout to 5 minutes (300000 ms)
* uncommented XA timeout tests
* updated documentation

Modified: trunk/docs/user-manual/en/transaction-config.xml
===================================================================
--- trunk/docs/user-manual/en/transaction-config.xml	2009-10-01 07:57:16 UTC (rev 8020)
+++ trunk/docs/user-manual/en/transaction-config.xml	2009-10-01 08:27:04 UTC (rev 8021)
@@ -24,9 +24,9 @@
         started but the forgotten about. Maybe the client died and never came back. If this happens
         then the transaction will just sit there indefinitely.</para>
     <para>To cope with this HornetQ can, if configured, scan for old transactions and rollback any
-        it finds. The default for this is 60000 milliseconds (1 minute), i.e. any transactions older
-        than 60 seconds are removed, however this can be changed by editing the <literal
-            >transaction-timeout</literal> property in <literal>hornetq-configuration.xml</literal>.
+        it finds. The default for this is 3000000 milliseconds (5 minutes), i.e. any transactions older
+        than 5 minutes are removed. This timeout can be changed by editing the <literal
+            >transaction-timeout</literal> property in <literal>hornetq-configuration.xml</literal> (value must be in milliseconds).
         The property <literal>transaction-timeout-scan-period</literal> configures how often, in
         milliseconds, to scan for old transactions.</para>
 </chapter>

Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2009-10-01 07:57:16 UTC (rev 8020)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2009-10-01 08:27:04 UTC (rev 8021)
@@ -116,7 +116,7 @@
 
    public static final int DEFAULT_MESSAGE_COUNTER_MAX_DAY_HISTORY = 10;
 
-   public static final long DEFAULT_TRANSACTION_TIMEOUT = 60000;
+   public static final long DEFAULT_TRANSACTION_TIMEOUT = 300000; // 5 minutes
 
    public static final long DEFAULT_TRANSACTION_TIMEOUT_SCAN_PERIOD = 1000;
 

Modified: trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java	2009-10-01 07:57:16 UTC (rev 8020)
+++ trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java	2009-10-01 08:27:04 UTC (rev 8021)
@@ -24,6 +24,7 @@
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import javax.transaction.xa.Xid;
 
@@ -52,12 +53,12 @@
 
    private boolean started = false;
 
-   //private TxTimeoutHandler task;
+   private TxTimeoutHandler task;
 
    private final long txTimeoutScanPeriod;
 
-   //private final ScheduledExecutorService scheduledThreadPool;
-
+   private final ScheduledExecutorService scheduledThreadPool;
+   
    public ResourceManagerImpl(final int defaultTimeoutSeconds, 
                               final long txTimeoutScanPeriod, 
                               final ScheduledExecutorService scheduledThreadPool)
@@ -65,7 +66,7 @@
       this.defaultTimeoutSeconds = defaultTimeoutSeconds;
       this.timeoutSeconds = defaultTimeoutSeconds;
       this.txTimeoutScanPeriod = txTimeoutScanPeriod;
-     // this.scheduledThreadPool = scheduledThreadPool;
+      this.scheduledThreadPool = scheduledThreadPool;
    }
 
    // HornetQComponent implementation
@@ -76,10 +77,9 @@
       {
          return;
       }
-      //todo - https://jira.jboss.org/jira/browse/HORNETQ-106
-      /*task = new TxTimeoutHandler();
+      task = new TxTimeoutHandler();
       Future<?> future = scheduledThreadPool.scheduleAtFixedRate(task, txTimeoutScanPeriod, txTimeoutScanPeriod, TimeUnit.MILLISECONDS);
-      task.setFuture(future);*/
+      task.setFuture(future);
       
       started = true;
    }
@@ -90,10 +90,10 @@
       {
          return;
       }
-      /*if (task != null)
+      if (task != null)
       {
          task.close();
-      }*/
+      }
 
       started = false;
    }
@@ -137,7 +137,7 @@
          this.timeoutSeconds = timeoutSeconds;
       }
 
-      return false;
+      return true;
    }
 
    public List<Xid> getPreparedTransactions()

Modified: trunk/tests/src/org/hornetq/tests/integration/xa/XaTimeoutTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/xa/XaTimeoutTest.java	2009-10-01 07:57:16 UTC (rev 8020)
+++ trunk/tests/src/org/hornetq/tests/integration/xa/XaTimeoutTest.java	2009-10-01 08:27:04 UTC (rev 8021)
@@ -65,12 +65,8 @@
 
    private SimpleString atestq = new SimpleString("atestq");
 
-   public void test()
+   protected void setUp() throws Exception
    {
-
-   }
-   /*protected void setUp() throws Exception
-   {
       super.setUp();
       
       addressSettings.clear();
@@ -559,5 +555,5 @@
       {
          return Collections.emptySet();
       }
-   }*/
+   }
 }



More information about the hornetq-commits mailing list