Author: rajdavies
Date: Wed Mar 12 13:59:54 2008
New Revision: 636507

URL: http://svn.apache.org/viewvc?rev=636507&view=rev
Log:
try and allow for zero pretech consumers with lazy dispatch

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

Modified: 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=636507&r1=636506&r2=636507&view=diff
==============================================================================
--- 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
 (original)
+++ 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
 Wed Mar 12 13:59:54 2008
@@ -1097,12 +1097,18 @@
     
     private int getConsumerMessageCountBeforeFull() throws Exception {
         int total = 0;
+        boolean zeroPrefetch = false;
         synchronized (consumers) {
             for (Subscription s : consumers) {
-                total += ((PrefetchSubscription) s).countBeforeFull();
+               PrefetchSubscription ps = (PrefetchSubscription) s;
+               zeroPrefetch |= ps.getPrefetchSize() == 0;
+               int countBeforeFull = ps.countBeforeFull();
+                total += countBeforeFull;
             }
         }
-
+        if (total==0 && zeroPrefetch){
+               total=1;
+        }
         return total;
     }
 


Reply via email to