activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r382692 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
Date Fri, 03 Mar 2006 06:50:40 GMT
Author: rajdavies
Date: Thu Mar  2 22:50:38 2006
New Revision: 382692

URL: http://svn.apache.org/viewcvs?rev=382692&view=rev
Log:
log when discarding messages - and ensure we don't get npe

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java?rev=382692&r1=382691&r2=382692&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
Thu Mar  2 22:50:38 2006
@@ -19,10 +19,8 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.LinkedList;
-
 import javax.jms.InvalidSelectorException;
 import javax.jms.JMSException;
-
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -34,9 +32,11 @@
 import org.apache.activemq.command.MessageDispatchNotification;
 import org.apache.activemq.memory.UsageManager;
 import org.apache.activemq.transaction.Synchronization;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class TopicSubscription extends AbstractSubscription {
-    
+    private static final Log log = LogFactory.getLog(TopicSubscription.class);
     final protected LinkedList matched = new LinkedList();
     final protected ActiveMQDestination dlqDestination = new ActiveMQQueue("ActiveMQ.DLQ");
     final protected UsageManager usageManager;
@@ -62,8 +62,9 @@
 
                     // NOTE - be careful about the slaveBroker!
                     if (maximumPendingMessages > 0) {
+                        log.warn("discarding " + (matched.size() - maximumPendingMessages)
+ " messages for slow consumer");
                         // lets discard old messages as we are a slow consumer
-                        while (matched.size() > maximumPendingMessages) {
+                        while (!matched.isEmpty() && matched.size() > maximumPendingMessages)
{
                             MessageReference oldMessage = (MessageReference) matched.removeFirst();
                             oldMessage.decrementReferenceCount();
                         }



Mime
View raw message