activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1038296 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Date Tue, 23 Nov 2010 19:36:36 GMT
Author: gtully
Date: Tue Nov 23 19:36:35 2010
New Revision: 1038296

URL: http://svn.apache.org/viewvc?rev=1038296&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2695 - rework getMessageCount to just use the
index, build on changes from -  https://issues.apache.org/activemq/browse/AMQ-2985

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=1038296&r1=1038295&r2=1038296&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Tue Nov 23 19:36:35 2010
@@ -720,7 +720,6 @@ public class KahaDBStore extends Message
 
         public int getMessageCount(String clientId, String subscriptionName) throws IOException
{
             final String subscriptionKey = subscriptionKey(clientId, subscriptionName);
-            final SubscriptionInfo info = lookupSubscription(clientId, subscriptionName);
             indexLock.writeLock().lock();
             try {
                 return pageFile.tx().execute(new Transaction.CallableClosure<Integer,
IOException>() {
@@ -733,30 +732,12 @@ public class KahaDBStore extends Message
                         }
 
                         int counter = 0;
-                        try {
-                            String selector = info.getSelector();
-                            BooleanExpression selectorExpression = null;
-                            if (selector != null) {
-                                selectorExpression = SelectorParser.parse(selector);
-                            }
-                            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++;
-                                }
+                        for (Iterator<Entry<Long, HashSet<String>>> iterator
=
+                                sd.ackPositions.iterator(tx, cursorPos.lastAckedSequence);
iterator.hasNext();) {
+                            Entry<Long, HashSet<String>> entry = iterator.next();
+                            if (entry.getValue().contains(subscriptionKey)) {
+                                counter++;
                             }
-                            sd.orderIndex.resetCursorPosition();
-                        } catch (Exception e) {
-                            throw IOExceptionSupport.create(e);
                         }
                         return counter;
                     }



Mime
View raw message