[hornetq-commits] JBoss hornetq SVN: r10401 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/remote.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 28 17:13:54 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-03-28 17:13:54 -0400 (Mon, 28 Mar 2011)
New Revision: 10401

Modified:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
Log:
Fixing PingStressTest

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java	2011-03-28 14:53:30 UTC (rev 10400)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java	2011-03-28 21:13:54 UTC (rev 10401)
@@ -14,6 +14,7 @@
 package org.hornetq.tests.stress.remote;
 
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.Interceptor;
@@ -122,11 +123,11 @@
 
       server.getRemotingService().addInterceptor(noPongInterceptor);
       ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(transportConfig);
+      locator.setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
+      locator.setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
+      locator.setCallTimeout(PingStressTest.PING_INTERVAL * 10);
       final ClientSessionFactory csf1 = locator.createSessionFactory();
 
-      csf1.getServerLocator().setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
-      csf1.getServerLocator().setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
-      csf1.getServerLocator().setCallTimeout(PingStressTest.PING_INTERVAL * 10);
 
       final int numberOfSessions = 1;
       final int numberOfThreads = 30;
@@ -153,12 +154,12 @@
             {
 
                ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(transportConfig);
+               locator.setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
+               locator.setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
+               locator.setCallTimeout(PingStressTest.PING_INTERVAL * 10);
+
                final ClientSessionFactory csf2 = locator.createSessionFactory();
 
-               csf2.getServerLocator().setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
-               csf2.getServerLocator().setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
-               csf2.getServerLocator().setCallTimeout(PingStressTest.PING_INTERVAL * 10);
-
                // Start all at once to make concurrency worst
                flagAligned.countDown();
                flagStart.await();
@@ -185,10 +186,15 @@
                   Thread.sleep(PingStressTest.PING_INTERVAL * (threadNumber % 3));
 
                   session.close();
+                  
+                  csf2.close();
+                  
+                  locator.close();
                }
             }
             catch (Throwable e)
             {
+               e.printStackTrace();
                failure = e;
             }
          }
@@ -202,7 +208,7 @@
          threads[i].start();
       }
 
-      flagAligned.await();
+      assertTrue(flagAligned.await(10, TimeUnit.SECONDS));
       flagStart.countDown();
 
       Throwable e = null;
@@ -219,6 +225,8 @@
       {
          throw new Exception("Test Failed", e);
       }
+      
+      csf1.close();
 
    }
 



More information about the hornetq-commits mailing list