activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r540142 - /activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Date Mon, 21 May 2007 13:48:12 GMT
Author: jstrachan
Date: Mon May 21 06:48:10 2007
New Revision: 540142

URL: http://svn.apache.org/viewvc?view=rev&rev=540142
Log:
applied patch from Gaetan to avoid missing a message. For background see: http://www.nabble.com/Ajax-amq%3A-Lost-messages-in-MessageListenerServlet-if-more-than-maxMessages-waiting-tf3785745s2354.html#a10705883

Modified:
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java?view=diff&rev=540142&r1=540141&r2=540142
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/MessageListenerServlet.java
Mon May 21 06:48:10 2007
@@ -336,16 +336,18 @@
                     continue;
 
                 // Look for any available messages
-                message = consumer.receiveNoWait();
-                while (message != null && messages < maximumMessages) {
+                while (messages < maximumMessages) {
+                    message = consumer.receiveNoWait();
+                    if (message == null) {
+                        break;
+                    }
+                    messages++;
                     String id = (String) consumerIdMap.get(consumer);
                     writer.print("<response id='");
                     writer.print(id);
                     writer.print("'>");
                     writeMessageResponse(writer, message);
                     writer.println("</response>");
-                    messages++;
-                    message = consumer.receiveNoWait();
                 }
             }
 



Mime
View raw message