[hornetq-commits] JBoss hornetq SVN: r8273 - trunk/tests/src/org/hornetq/tests/integration/client.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 12 09:38:04 EST 2009


Author: ataylor
Date: 2009-11-12 09:38:03 -0500 (Thu, 12 Nov 2009)
New Revision: 8273

Modified:
   trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
Log:
added latch instead of sleep to fix test

Modified: trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java	2009-11-12 14:36:45 UTC (rev 8272)
+++ trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java	2009-11-12 14:38:03 UTC (rev 8273)
@@ -184,6 +184,7 @@
                                                      .iterator()
                                                      .next();
       final CountDownLatch latch = new CountDownLatch(1);
+      final CountDownLatch latch2 = new CountDownLatch(1);
       remotingConnection.addCloseListener(new CloseListener()
       {
          public void connectionClosed()
@@ -191,13 +192,21 @@
             latch.countDown();
          }
       });
-      
+
+      server.getRemotingService().getConnections().iterator().next().addCloseListener(new CloseListener()
+      {
+         public void connectionClosed()
+         {
+            latch2.countDown();
+         }
+      });
+
       ((ClientSessionInternal)session).getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "simulate a client failure"));
 
 
       // let some time for the server to clean the connections
-      latch.await(2 * CONNECTION_TTL + 1, TimeUnit.MILLISECONDS);
-      Thread.sleep(5000);
+      latch.await(2 * CONNECTION_TTL + 1000, TimeUnit.MILLISECONDS);
+      latch2.await(4 * CONNECTION_TTL + 1000, TimeUnit.MILLISECONDS);
       assertEquals(0, server.getConnectionCount());
       
       session.close();



More information about the hornetq-commits mailing list