[
https://issues.apache.org/jira/browse/ARTEMIS-4084?focusedWorklogId=824738&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-824738
]
ASF GitHub Bot logged work on ARTEMIS-4084:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 09/Nov/22 19:27
Start Date: 09/Nov/22 19:27
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #4283:
URL: https://github.com/apache/activemq-artemis/pull/4283#discussion_r1018333849
##########
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListImpl.java:
##########
@@ -203,20 +223,31 @@ public void addSorted(E e) {
// This would be an optimization for our usage.
// avoiding scanning the entire List just to add at the end, so we
compare the end first.
if (comparator.compare(tail.val(), e) >= 0) {
+ logger.trace("addTail as compare is after tail {}", e);
addTail(e);
return;
}
- Node<E> fetching = head.next;
- while (fetching.next != null) {
- int compareNext = comparator.compare(fetching.next.val(), e);
- if (compareNext <= 0) {
- addAfter(fetching, e);
- return;
+ if (lastAdd != null) { // as an optimization we check against the
last add rather than always scan.
+ if (lastAdd.prev != null && lastAdd.prev.val() != null) {
+ if (comparator.compare(lastAdd.prev.val(), e) > 0 &&
comparator.compare(lastAdd.val(), e) < 0) {
+ logger.trace("addABefore last element {}", e);
+ addAfter(lastAdd.prev, e);
+ return;
+ }
+ }
+ if (lastAdd.next != null && lastAdd.next.val() != null) {
+ if (comparator.compare(lastAdd.val(), e) > 0 &&
comparator.compare(lastAdd.next.val(), e) < 0) {
+ logger.trace("addAfter last element {}", e);
+ addAfter(lastAdd, e);
+ return;
+ }
}
- fetching = fetching.next;
}
+ if (addSortedScan(e))
+ return;
Review Comment:
lol
I didn't think about it.. just right click, refactor as a new method..
automatic change :)
Issue Time Tracking
-------------------
Worklog Id: (was: 824738)
Time Spent: 4h 40m (was: 4.5h)
> Rollbacking massive amounts of messages might crash broker
> ----------------------------------------------------------
>
> Key: ARTEMIS-4084
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4084
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Anton Roskvist
> Priority: Major
> Time Spent: 4h 40m
> Remaining Estimate: 0h
>
> Critical Analyzer triggers, but even if it is set to LOG or disabled the
> broker is put in such a bad state it becomes unresponsive until restarted.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)