[hornetq-commits] JBoss hornetq SVN: r11812 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Dec 2 08:16:41 EST 2011


Author: borges
Date: 2011-12-02 08:16:40 -0500 (Fri, 02 Dec 2011)
New Revision: 11812

Modified:
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
Log:
Need different instances of the SessionFailureListener, as they end up in a Set
of the same SessionFactory.

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java	2011-12-02 13:16:26 UTC (rev 11811)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java	2011-12-02 13:16:40 UTC (rev 11812)
@@ -13,6 +13,7 @@
 
 package org.hornetq.tests.integration.cluster.util;
 
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import junit.framework.Assert;
@@ -84,9 +85,10 @@
 
    public void crash(boolean waitFailure, ClientSession... sessions) throws Exception
    {
-      CountDownSessionFailureListener listener = new CountDownSessionFailureListener(sessions.length);
+      CountDownLatch latch = new CountDownLatch(sessions.length);
       for (ClientSession session : sessions)
       {
+         CountDownSessionFailureListener listener = new CountDownSessionFailureListener(latch);
          session.addFailureListener(listener);
       }
 
@@ -99,8 +101,8 @@
       if (waitFailure)
       {
          // Wait to be informed of failure
-         boolean ok = listener.getLatch().await(10000, TimeUnit.MILLISECONDS);
-         Assert.assertTrue("Failed to stop the server! Latch count is " + listener.getLatch().getCount() + " out of " +
+         boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);
+         Assert.assertTrue("Failed to stop the server! Latch count is " + latch.getCount() + " out of " +
                   sessions.length, ok);
       }
    }



More information about the hornetq-commits mailing list