activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1365871 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/ActiveMQQueueBrowser.java test/java/org/apache/activemq/joramtests/JoramJmsTest.java
Date Thu, 26 Jul 2012 03:11:45 GMT
Author: chirino
Date: Thu Jul 26 03:11:45 2012
New Revision: 1365871

URL: http://svn.apache.org/viewvc?rev=1365871&view=rev
Log:
Fixes AMQ-3945: QueueBrowser missing messages on first browse.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java?rev=1365871&r1=1365870&r2=1365871&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQQueueBrowser.java
Thu Jul 26 03:11:45 2012
@@ -19,15 +19,13 @@ package org.apache.activemq;
 import java.util.Enumeration;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import javax.jms.*;
 import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
 
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConsumerId;
 import org.apache.activemq.command.MessageDispatch;
+import org.apache.activemq.selector.SelectorParser;
 
 /**
  * A client uses a <CODE>QueueBrowser</CODE> object to look at messages on a
@@ -69,27 +67,27 @@ public class ActiveMQQueueBrowser implem
 
     /**
      * Constructor for an ActiveMQQueueBrowser - used internally
-     *
-     * @param theSession
-     * @param dest
-     * @param selector
      * @throws JMSException
      */
     protected ActiveMQQueueBrowser(ActiveMQSession session, ConsumerId consumerId, ActiveMQDestination
destination, String selector, boolean dispatchAsync) throws JMSException {
+        if (destination == null) {
+            throw new InvalidDestinationException("Don't understand null destinations");
+        } else if (destination.getPhysicalName() == null) {
+            throw new InvalidDestinationException("The destination object was not given a
physical name.");
+        }
+        if (selector != null && selector.trim().length() != 0) {
+            // Validate the selector
+            SelectorParser.parse(selector);
+        }
+
         this.session = session;
         this.consumerId = consumerId;
         this.destination = destination;
         this.selector = selector;
         this.dispatchAsync = dispatchAsync;
-        this.consumer = createConsumer();
     }
 
     /**
-     * @param session
-     * @param originalDestination
-     * @param selectorExpression
-     * @param cnum
-     * @return
      * @throws JMSException
      */
     private ActiveMQMessageConsumer createConsumer() throws JMSException {
@@ -185,7 +183,7 @@ public class ActiveMQQueueBrowser implem
             }
 
             try {
-                Message answer = consumer.receiveNoWait();
+                javax.jms.Message answer = consumer.receiveNoWait();
                 if (answer != null) {
                     return answer;
                 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java?rev=1365871&r1=1365870&r2=1365871&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
Thu Jul 26 03:11:45 2012
@@ -28,6 +28,7 @@ import org.objectweb.jtests.jms.conform.
 import org.objectweb.jtests.jms.conform.message.headers.MessageHeaderTest;
 import org.objectweb.jtests.jms.conform.message.properties.JMSXPropertyTest;
 import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyConversionTest;
+import org.objectweb.jtests.jms.conform.queue.QueueBrowserTest;
 import org.objectweb.jtests.jms.conform.queue.TemporaryQueueTest;
 import org.objectweb.jtests.jms.conform.selector.SelectorSyntaxTest;
 import org.objectweb.jtests.jms.conform.session.QueueSessionTest;
@@ -58,9 +59,9 @@ public class JoramJmsTest extends TestCa
         suite.addTestSuite(TopicSessionTest.class);
         suite.addTestSuite(TemporaryTopicTest.class);
         suite.addTestSuite(UnifiedSessionTest.class);
+        suite.addTestSuite(QueueBrowserTest.class);
 // TODO: figure out why the following tests are failing..
 //        suite.addTestSuite(MessagePropertyTest.class);
-//        suite.addTestSuite(QueueBrowserTest.class);
 //        suite.addTestSuite(SelectorTest.class);
         return suite;
     }



Mime
View raw message