git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1038296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-11-23 19:36:35 +00:00
parent 8871c67e8f
commit 21664a9609
1 changed files with 5 additions and 24 deletions

View File

@ -720,7 +720,6 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
public int getMessageCount(String clientId, String subscriptionName) throws IOException { public int getMessageCount(String clientId, String subscriptionName) throws IOException {
final String subscriptionKey = subscriptionKey(clientId, subscriptionName); final String subscriptionKey = subscriptionKey(clientId, subscriptionName);
final SubscriptionInfo info = lookupSubscription(clientId, subscriptionName);
indexLock.writeLock().lock(); indexLock.writeLock().lock();
try { try {
return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() {
@ -733,30 +732,12 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
} }
int counter = 0; int counter = 0;
try { for (Iterator<Entry<Long, HashSet<String>>> iterator =
String selector = info.getSelector(); sd.ackPositions.iterator(tx, cursorPos.lastAckedSequence); iterator.hasNext();) {
BooleanExpression selectorExpression = null; Entry<Long, HashSet<String>> entry = iterator.next();
if (selector != null) { if (entry.getValue().contains(subscriptionKey)) {
selectorExpression = SelectorParser.parse(selector); counter++;
} }
sd.orderIndex.resetCursorPosition();
sd.orderIndex.setBatch(tx, cursorPos);
for (Iterator<Entry<Long, MessageKeys>> iterator = sd.orderIndex.iterator(tx); iterator
.hasNext();) {
Entry<Long, MessageKeys> entry = iterator.next();
if (selectorExpression != null) {
MessageEvaluationContext ctx = new MessageEvaluationContext();
ctx.setMessageReference(loadMessage(entry.getValue().location));
if (selectorExpression.matches(ctx)) {
counter++;
}
} else {
counter++;
}
}
sd.orderIndex.resetCursorPosition();
} catch (Exception e) {
throw IOExceptionSupport.create(e);
} }
return counter; return counter;
} }