try and allow for zero pretech consumers with lazy dispatch

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@636507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-12 20:59:54 +00:00
parent 290ce2a6bf
commit 93ccb9ca3b
1 changed files with 8 additions and 2 deletions

View File

@ -1097,12 +1097,18 @@ public class Queue extends BaseDestination implements Task {
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;
}