mirror of https://github.com/apache/activemq.git
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.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1356868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
902c6e98aa
commit
bb1e246c1b
|
@ -16,6 +16,16 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.transport.failover;
|
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.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -24,15 +34,6 @@ import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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 {
|
public class InitalReconnectDelayTest {
|
||||||
|
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(InitalReconnectDelayTest.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(InitalReconnectDelayTest.class);
|
||||||
|
@ -59,17 +60,16 @@ public class InitalReconnectDelayTest {
|
||||||
|
|
||||||
//Halt the broker1...
|
//Halt the broker1...
|
||||||
LOG.info("Stopping the Broker1...");
|
LOG.info("Stopping the Broker1...");
|
||||||
|
start = (new Date()).getTime();
|
||||||
broker1.stop();
|
broker1.stop();
|
||||||
|
|
||||||
LOG.info("Attempting to send... failover should kick in...");
|
LOG.info("Attempting to send... failover should kick in...");
|
||||||
start = (new Date()).getTime();
|
|
||||||
producer.send(session.createTextMessage("TEST"));
|
producer.send(session.createTextMessage("TEST"));
|
||||||
end = (new Date()).getTime();
|
end = (new Date()).getTime();
|
||||||
|
|
||||||
//Inital reconnection should kick in and be darned close to what we expected
|
//Inital reconnection should kick in and be darned close to what we expected
|
||||||
LOG.info("Failover took " + (end - start) + " ms.");
|
LOG.info("Failover took " + (end - start) + " ms.");
|
||||||
assertTrue("Failover took " + (end - start) + " ms and should be > 14000.", (end - start) > 14000);
|
assertTrue("Failover took " + (end - start) + " ms and should be > 14000.", (end - start) > 14000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
Loading…
Reference in New Issue