[AMQ-7407] Fix best target election for queue/topic partitioning

This commit is contained in:
jbonofre 2020-02-27 21:39:11 +01:00
parent 6e650841fd
commit 5f51b9c084
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;