fix race condition in test that validates dequeue count, thanks Al on irc

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@825084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-10-14 11:11:03 +00:00
parent a015154bd8
commit aef4ccfe8f
1 changed files with 8 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import javax.jms.Session;
import org.apache.activemq.JmsMultipleBrokersTestSupport;
import org.apache.activemq.broker.jmx.BrokerView;
import org.apache.activemq.util.Wait;
public class AMQ2439Test extends JmsMultipleBrokersTestSupport {
Destination dest;
@ -39,9 +40,14 @@ public class AMQ2439Test extends JmsMultipleBrokersTestSupport {
}
private void validateQueueStats() throws Exception {
BrokerView brokerView = brokers.get("BrokerA").broker.getAdminView();
final BrokerView brokerView = brokers.get("BrokerA").broker.getAdminView();
assertEquals("enequeue is correct", 1000, brokerView.getTotalEnqueueCount());
assertEquals("dequeue is correct", 1000, brokerView.getTotalDequeueCount());
assertTrue("dequeue is correct", Wait.waitFor(new Wait.Condition() {
public boolean isSatisified() throws Exception {
return 1000 == brokerView.getTotalDequeueCount();
}
}));
}
protected int receiveExactMessages(String brokerName, int msgCount) throws Exception {