tabish121 commented on code in PR #5142:
URL: https://github.com/apache/activemq-artemis/pull/5142#discussion_r1714271860
##########
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedListImpl.java:
##########
@@ -54,6 +54,9 @@ public PriorityLinkedListImpl(final int priorities,
Comparator<E> comparator) {
}
private void checkHighest(final int priority) {
+ for (int i = levels.length - 1; i >= 0 && levels[i].size() == 0; i--) {
Review Comment:
Had a look at this and I think this loop is probably not needed if the check
in the loop in the iterator remove uses the correct exit terms. Currently in
the remove it scans for the next highest but it is checking using the wrong
variable and always reading from the same collection (index)
` for (int i = index; i >= 0 && levels[index].size() == 0; i--) {
highestPriority = i;
}
`
When it should be using the loop variable 'i' so that it exits as soon as a
non-empty collection is found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact