Merge pull request #482 from jbonofre/AMQ-7407

[AMQ-7407] Fix best target election for queue/topic partitioning
This commit is contained in:
Jean-Baptiste Onofré 2020-02-28 07:32:22 +01:00 committed by GitHub
commit 702fb86887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -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;