[
https://issues.apache.org/jira/browse/AMQ-7407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17047244#comment-17047244
]
ASF subversion and git services commented on AMQ-7407:
------------------------------------------------------
Commit 702fb86887dac79ae206c26693ee8fdc88c0e1b5 in activemq's branch
refs/heads/master from Jean-Baptiste Onofré
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=702fb86 ]
Merge pull request #482 from jbonofre/AMQ-7407
[AMQ-7407] Fix best target election for queue/topic partitioning
> Partitioning by queue/topic chooses incorrect target
> ----------------------------------------------------
>
> Key: AMQ-7407
> URL: https://issues.apache.org/jira/browse/AMQ-7407
> Project: ActiveMQ
> Issue Type: Bug
> Reporter: Maksym Brodin
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 5.16.0, 5.15.12
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> This code always returns the latest target, instead of the best target (with
> the largest score)
> [https://github.com/apache/activemq/blob/master/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java#L251]
>
> {code:java}
> // The target with largest score wins..
> if( !targetScores.isEmpty() ) {
> Target bestTarget = null;
> int bestScore=0;
> for (Map.Entry<Target, Score> entry : targetScores.entrySet()) {
> if( entry.getValue().value > bestScore ) {
> bestTarget = entry.getKey();
> }
> }
> return bestTarget;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)