activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-4758 - improve performance of pull consumers
Date Tue, 01 Oct 2013 10:22:30 GMT
Updated Branches:
  refs/heads/trunk e64f83abc -> 2a5ad365d


https://issues.apache.org/jira/browse/AMQ-4758 - improve performance of pull consumers


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/2a5ad365
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/2a5ad365
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/2a5ad365

Branch: refs/heads/trunk
Commit: 2a5ad365d7925705418a17c78ee253fa005ee130
Parents: e64f83a
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Tue Oct 1 12:21:50 2013 +0200
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Tue Oct 1 12:22:19 2013 +0200

----------------------------------------------------------------------
 .../org/apache/activemq/broker/region/Queue.java   | 17 +++++------------
 activemq-unit-tests/pom.xml                        | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/2a5ad365/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
index 53f686f..ee5bb2e 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
@@ -2003,13 +2003,6 @@ public class Queue extends BaseDestination implements Task, UsageListener
{
             consumersLock.writeLock().unlock();
         }
 
-        PendingList rc;
-        if(isPrioritizedMessages()) {
-            rc = new PrioritizedPendingList();
-        } else {
-            rc = new OrderedPendingList();
-        }
-
         Set<Subscription> fullConsumers = new HashSet<Subscription>(this.consumers.size());
 
         for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();)
{
@@ -2027,6 +2020,7 @@ public class Queue extends BaseDestination implements Task, UsageListener
{
                         if (dispatchSelector.canSelect(s, node) && assignMessageGroup(s,
(QueueMessageReference)node) && !((QueueMessageReference) node).isAcked() ) {
                             // Dispatch it.
                             s.add(node);
+                            iterator.remove();
                             target = s;
                             break;
                         }
@@ -2043,10 +2037,9 @@ public class Queue extends BaseDestination implements Task, UsageListener
{
                 }
             }
 
-            if ((target == null && interestCount > 0) || consumers.size() == 0)
{
-                // This means all subs were full or that there are no
-                // consumers...
-                rc.addMessageLast(node);
+            // return if there are no consumers or all consumers are full
+            if (target == null && (consumers.size() == 0 || consumers.size() == fullConsumers.size()))
{
+                return list;
             }
 
             // If it got dispatched, rotate the consumer list to get round robin
@@ -2065,7 +2058,7 @@ public class Queue extends BaseDestination implements Task, UsageListener
{
             }
         }
 
-        return rc;
+        return list;
     }
 
     protected boolean assignMessageGroup(Subscription subscription, QueueMessageReference
node) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq/blob/2a5ad365/activemq-unit-tests/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/pom.xml b/activemq-unit-tests/pom.xml
index 6e1c5b9..157aa99 100755
--- a/activemq-unit-tests/pom.xml
+++ b/activemq-unit-tests/pom.xml
@@ -250,6 +250,20 @@
       <artifactId>regexp</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>5.1.17</version>
+      <optional>true</optional>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-dbcp</groupId>
+      <artifactId>commons-dbcp</artifactId>
+      <version>1.4</version>
+      <optional>true</optional>
+      <scope>test</scope>
+    </dependency>
 
     <!--  Joram JMS conformance tests -->
     <dependency>


Mime
View raw message