summaryrefslogtreecommitdiff
path: root/java/client/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2006-10-12 16:32:47 +0000
committerGordon Sim <gsim@apache.org>2006-10-12 16:32:47 +0000
commit0629359c41c88ab1b7c14c96cb4735fbc25764f7 (patch)
tree16ffdf589ee283e569fea4232384ba7f19fba363 /java/client/src
parentaf5784ad936f12da595618a48214a83c64acdbfb (diff)
downloadqpid-python-0629359c41c88ab1b7c14c96cb4735fbc25764f7.tar.gz
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
Diffstat (limited to 'java/client/src')
-rw-r--r--java/client/src/org/apache/qpid/client/AMQSession.java6
1 files changed, 6 insertions, 0 deletions
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);