resolve https://issues.apache.org/activemq/browse/AMQ-2075 - async dispatch of brokerInfo could end up getting dispatched after messages

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@798842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-07-29 10:26:19 +00:00
parent 66dd8cdae3
commit 6f3c99991d
1 changed files with 9 additions and 6 deletions

View File

@ -1127,7 +1127,8 @@ public class BrokerTest extends BrokerTestSupport {
}
// give the async ack a chance to perculate and validate all are currently consumed
assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
Message msg = receiveMessage(connection1, MAX_NULL_WAIT);
assertNull("all messages were received " + msg, msg);
// Close the connection, this should in turn close the consumer.
connection1.request(closeConnectionInfo(connectionInfo1));
@ -1135,7 +1136,7 @@ public class BrokerTest extends BrokerTestSupport {
// Send another message, connection1 should not get the message.
connection2.request(createMessage(producerInfo2, destination, deliveryMode));
assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
assertNull("no message received", receiveMessage(connection1, MAX_NULL_WAIT));
}
public void initCombosForTestSessionCloseCascades() {
@ -1187,7 +1188,7 @@ public class BrokerTest extends BrokerTestSupport {
// Send another message, connection1 should not get the message.
connection2.request(createMessage(producerInfo2, destination, deliveryMode));
Object msg = connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS);
Message msg = receiveMessage(connection1,MAX_NULL_WAIT);
assertNull("no message received from connection1 after session close", msg);
}
@ -1235,7 +1236,8 @@ public class BrokerTest extends BrokerTestSupport {
}
// give the async ack a chance to perculate and validate all are currently consumed
Object result = connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS);
// use receive rather than poll as broker info is sent async and may still need to be dequeued
Message result = receiveMessage(connection1, MAX_NULL_WAIT);
assertNull("no more messages " + result, result);
// Close the consumer.
@ -1244,7 +1246,8 @@ public class BrokerTest extends BrokerTestSupport {
// Send another message, connection1 should not get the message.
connection2.request(createMessage(producerInfo2, destination, deliveryMode));
assertNull(connection1.getDispatchQueue().poll(MAX_NULL_WAIT, TimeUnit.MILLISECONDS));
result = receiveMessage(connection1, MAX_NULL_WAIT);
assertNull("no message received after close " + result, result);
}
public void initCombosForTestTopicNoLocal() {