This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
     new 0c20c48  [AMQ-7407] Fix best target election for queue/topic 
partitioning
0c20c48 is described below

commit 0c20c4832f331e8b626df3d3efcd26da4a86ceb3
Author: jbonofre <[email protected]>
AuthorDate: Thu Feb 27 21:39:11 2020 +0100

    [AMQ-7407] Fix best target election for queue/topic partitioning
    
    (cherry picked from commit 5f51b9c084e38f8f10418398dbfe415d4570e325)
---
 .../main/java/org/apache/activemq/partition/PartitionBroker.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
 
b/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
index 7c6d169..9362e64 100644
--- 
a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
+++ 
b/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
@@ -248,12 +248,13 @@ public class PartitionBroker extends BrokerFilter {
             }
 
             // The target with largest score wins..
-            if( !targetScores.isEmpty() ) {
+            if (!targetScores.isEmpty()) {
                 Target bestTarget = null;
-                int bestScore=0;
+                int bestScore = 0;
                 for (Map.Entry<Target, Score> entry : targetScores.entrySet()) 
{
-                    if( entry.getValue().value > bestScore ) {
+                    if (entry.getValue().value > bestScore) {
                         bestTarget = entry.getKey();
+                        bestScore = entry.getValue().value;
                     }
                 }
                 return bestTarget;

Reply via email to