You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/07/03 21:04:50 UTC

svn commit: r1356868 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java

Author: tabish
Date: Tue Jul  3 19:04:49 2012
New Revision: 1356868

URL: http://svn.apache.org/viewvc?rev=1356868&view=rev
Log:
The start time needs to be set before stopping broker1 in order to account for context switching that can cause the failover process to start before the current call to track the failover start time. 

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java?rev=1356868&r1=1356867&r2=1356868&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/InitalReconnectDelayTest.java Tue Jul  3 19:04:49 2012
@@ -16,6 +16,16 @@
  */
 package org.apache.activemq.transport.failover;
 
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jms.Connection;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.junit.After;
@@ -24,15 +34,6 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.Connection;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import java.util.Date;
-import java.util.concurrent.CountDownLatch;
-
-import static org.junit.Assert.assertTrue;
-
 public class InitalReconnectDelayTest {
 
     private static final transient Logger LOG = LoggerFactory.getLogger(InitalReconnectDelayTest.class);
@@ -59,17 +60,16 @@ public class InitalReconnectDelayTest {
 
         //Halt the broker1...
         LOG.info("Stopping the Broker1...");
+        start = (new Date()).getTime();
         broker1.stop();
 
         LOG.info("Attempting to send... failover should kick in...");
-        start = (new Date()).getTime();
         producer.send(session.createTextMessage("TEST"));
         end = (new Date()).getTime();
 
         //Inital reconnection should kick in and be darned close to what we expected
         LOG.info("Failover took " + (end - start) + " ms.");
         assertTrue("Failover took " + (end - start) + " ms and should be > 14000.", (end - start) > 14000);
-
     }
 
     @Before