From 0629359c41c88ab1b7c14c96cb4735fbc25764f7 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 12 Oct 2006 16:32:47 +0000 Subject: Fixed ack.RecoverTest and ack.DisconnectAndRedeliverTest. These were failing due to a race condition where the consumers queue was not bound by the time the publisher sent messages. This is a result of the use of nowait=true for the declare/bind/consume cycle for a BasicMessageConsumer. To work around this in tests like these that have two connections, one consuming & one publishing, I added a declareExchangeSynch() method to AMQSession which allows a thread to block until the session it invokes that method on has processed all the commands up to that point. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@463309 13f79535-47bb-0310-9956-ffa450edef68 --- java/client/src/org/apache/qpid/client/AMQSession.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'java/client/src') diff --git a/java/client/src/org/apache/qpid/client/AMQSession.java b/java/client/src/org/apache/qpid/client/AMQSession.java index 3bc670e609..1f15c24cb2 100644 --- a/java/client/src/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/org/apache/qpid/client/AMQSession.java @@ -785,6 +785,12 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi declareExchange(name, type, _connection.getProtocolHandler()); } + public void declareExchangeSynch(String name, String type) throws AMQException + { + AMQFrame frame = ExchangeDeclareBody.createAMQFrame(_channelId, 0, name, type, false, false, false, false, false, null); + _connection.getProtocolHandler().syncWrite(frame, ExchangeDeclareOkBody.class); + } + private void declareExchange(AMQDestination amqd, AMQProtocolHandler protocolHandler) { declareExchange(amqd.getExchangeName(), amqd.getExchangeClass(), protocolHandler); -- cgit v1.2.1