Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 37497 invoked from network); 22 Sep 2008 19:30:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Sep 2008 19:30:26 -0000 Received: (qmail 40661 invoked by uid 500); 22 Sep 2008 19:30:23 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 40643 invoked by uid 500); 22 Sep 2008 19:30:23 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 40634 invoked by uid 99); 22 Sep 2008 19:30:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Sep 2008 12:30:23 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Sep 2008 19:29:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 316B0238896D; Mon, 22 Sep 2008 12:30:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r697957 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java Date: Mon, 22 Sep 2008 19:30:05 -0000 To: commits@activemq.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080922193005.316B0238896D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rajdavies Date: Mon Sep 22 12:30:04 2008 New Revision: 697957 URL: http://svn.apache.org/viewvc?rev=697957&view=rev Log: Fix for https://issues.apache.org/activemq/browse/AMQ-1947 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=697957&r1=697956&r2=697957&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 Mon Sep 22 12:30:04 2008 @@ -18,11 +18,13 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -84,7 +86,7 @@ protected PendingMessageCursor messages; private final LinkedHashMap pagedInMessages = new LinkedHashMap(); // Messages that are paged in but have not yet been targeted at a subscription - private List pagedInPendingDispatch = new ArrayList(100); + private LinkedHashSet pagedInPendingDispatch = new LinkedHashSet(100); private MessageGroupMap messageGroupOwners; private DispatchPolicy dispatchPolicy = new RoundRobinDispatchPolicy(); private MessageGroupMapFactory messageGroupMapFactory = new MessageGroupHashBucketFactory(); @@ -1217,15 +1219,7 @@ // the pending // list anything that does not actually get dispatched. if (list != null && !list.isEmpty()) { - if (pagedInPendingDispatch.isEmpty()) { - pagedInPendingDispatch.addAll(doActualDispatch(list)); - } else { - for (QueueMessageReference qmr : list) { - if (!pagedInPendingDispatch.contains(qmr)) { - pagedInPendingDispatch.add(qmr); - } - } - } + pagedInPendingDispatch.addAll(doActualDispatch(list)); } } } finally { @@ -1237,8 +1231,8 @@ * @return list of messages that could get dispatched to consumers if they * were not full. */ - private List doActualDispatch(List list) throws Exception { - List rc = new ArrayList(list.size()); + private LinkedHashSet doActualDispatch(Collection collection) throws Exception { + LinkedHashSet rc = new LinkedHashSet(collection.size()); Set fullConsumers = new HashSet(this.consumers.size()); List consumers; @@ -1246,7 +1240,7 @@ consumers = new ArrayList(this.consumers); } - for (MessageReference node : list) { + for (MessageReference node : collection) { Subscription target = null; int interestCount=0; for (Subscription s : consumers) {