mirror of https://github.com/apache/activemq.git
Fixes AMQ-3945: QueueBrowser missing messages on first browse.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1365871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6da702be23
commit
6b305ba498
|
@ -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 implements QueueBrowser, Enumeration {
|
|||
|
||||
/**
|
||||
* 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 implements QueueBrowser, Enumeration {
|
|||
}
|
||||
|
||||
try {
|
||||
Message answer = consumer.receiveNoWait();
|
||||
javax.jms.Message answer = consumer.receiveNoWait();
|
||||
if (answer != null) {
|
||||
return answer;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.objectweb.jtests.jms.conform.message.MessageTypeTest;
|
|||
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 TestCase {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue