Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 47140 invoked from network); 10 Jan 2006 16:33:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jan 2006 16:33:54 -0000 Received: (qmail 26773 invoked by uid 500); 10 Jan 2006 16:33:54 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 26748 invoked by uid 500); 10 Jan 2006 16:33:54 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 26735 invoked by uid 99); 10 Jan 2006 16:33:54 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2006 08:33:54 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 10 Jan 2006 08:33:53 -0800 Received: (qmail 47021 invoked by uid 65534); 10 Jan 2006 16:33:33 -0000 Message-ID: <20060110163333.47013.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r367676 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region: QueueSubscription.java group/MessageGroupHashBucket.java Date: Tue, 10 Jan 2006 16:33:32 -0000 To: activemq-commits@geronimo.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: chirino Date: Tue Jan 10 08:33:13 2006 New Revision: 367676 URL: http://svn.apache.org/viewcvs?rev=367676&view=rev Log: - make the group sequences 0 based to match producer message sequences which are also 0 based - fixed bucket hashing method to handle cases where the group id hashes to a negative number. Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java?rev=367676&r1=367675&r2=367676&view=diff ============================================================================== --- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java (original) +++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java Tue Jan 10 08:33:13 2006 @@ -81,7 +81,7 @@ MessageGroupMap messageGroupOwners = ((Queue)node.getRegionDestination()).getMessageGroupOwners(); // If we can own the first, then no-one else should own the rest. - if( sequence==1 ) { + if( sequence==0 ) { if( node.lock(this) ) { messageGroupOwners.put(groupId, info.getConsumerId()); return true; @@ -107,7 +107,7 @@ if( groupOwner.equals(info.getConsumerId()) ) { // A group sequence < 1 is an end of group signal. - if ( sequence < 1 ) { + if ( sequence < 0 ) { messageGroupOwners.removeGroup(groupId); } return true; Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java?rev=367676&r1=367675&r2=367676&view=diff ============================================================================== --- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java (original) +++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java Tue Jan 10 08:33:13 2006 @@ -102,6 +102,10 @@ } protected int getBucketNumber(String groupId) { - return groupId.hashCode() % bucketCount; + int bucket = groupId.hashCode() % bucketCount; + // bucket could be negative + if( bucket < 0 ) + bucket *= -1; + return bucket; } }