activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
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 GMT
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;
     }
 }



Mime
View raw message