1 18 package org.apache.activemq.broker.region; 19 20 import java.io.IOException ; 21 import javax.jms.InvalidSelectorException ; 22 import org.apache.activemq.broker.Broker; 23 import org.apache.activemq.broker.ConnectionContext; 24 import org.apache.activemq.command.ConsumerInfo; 25 import org.apache.activemq.command.Message; 26 import org.apache.activemq.command.MessageAck; 27 import org.apache.activemq.command.MessageDispatch; 28 import org.apache.activemq.filter.MessageEvaluationContext; 29 30 public class QueueBrowserSubscription extends QueueSubscription { 31 32 boolean browseDone; 33 34 public QueueBrowserSubscription(Broker broker,ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException { 35 super(broker,context, info); 36 } 37 38 protected boolean canDispatch(MessageReference node) { 39 return !((QueueMessageReference)node).isAcked(); 40 } 41 42 public String toString() { 43 return 44 "QueueBrowserSubscription:" + 45 " consumer="+info.getConsumerId()+ 46 ", destinations="+destinations.size()+ 47 ", dispatched="+dispatched.size()+ 48 ", delivered="+this.prefetchExtension+ 49 ", pending="+getPendingQueueSize(); 50 } 51 52 public void browseDone() throws Exception { 53 browseDone = true; 54 add(QueueMessageReference.NULL_MESSAGE); 55 } 56 57 public boolean matches(MessageReference node, MessageEvaluationContext context) throws IOException { 58 return !browseDone && super.matches(node, context); 59 } 60 61 64 protected void acknowledge(ConnectionContext context, final MessageAck ack, final MessageReference n) throws IOException { 65 } 66 67 } 68 | Popular Tags |