You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2012/02/28 00:43:03 UTC
svn commit: r1294397 - in /qpid/trunk/qpid/java:
client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java
systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
Author: rgodfrey
Date: Mon Feb 27 23:43:02 2012
New Revision: 1294397
URL: http://svn.apache.org/viewvc?rev=1294397&view=rev
Log:
QPID-2621 : [Java Client] Calling QueueBrowser.getEnumeration on a stopped connection will hang
Modified:
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java?rev=1294397&r1=1294396&r2=1294397&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java Mon Feb 27 23:43:02 2012
@@ -132,6 +132,10 @@ public class AMQQueueBrowser implements
public Enumeration getEnumeration() throws JMSException
{
checkState();
+ if(!_session.getAMQConnection().started())
+ {
+ throw new IllegalStateException("Cannot enumerate message on the queue while the Connection is stopped");
+ }
final BasicMessageConsumer consumer =
(BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false);
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java?rev=1294397&r1=1294396&r2=1294397&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java Mon Feb 27 23:43:02 2012
@@ -420,4 +420,21 @@ public class QueueBrowserAutoAckTest ext
validate(messages);
}
+ public void testBrowsingWhileStopped() throws JMSException
+ {
+ _clientConnection.stop();
+
+ try
+ {
+ QueueBrowser browser = _clientSession.createBrowser(getTestQueue());
+ Enumeration messages = browser.getEnumeration();
+ fail("Expected exception when attempting to browse on a stopped connection did not occur");
+ }
+ catch(javax.jms.IllegalStateException e)
+ {
+ // pass
+ }
+
+ }
+
}
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org