From 77c965bab976212720cc93ddbf7388bb1acc1ebc Mon Sep 17 00:00:00 2001 From: ishland Date: Mon, 11 Nov 2024 12:46:51 +0800 Subject: [PATCH] Revert "perf: optimize TicketSet#getTargetStatus" This reverts commit e3c80d41701a1cbee3a1352e037c1e3c33214dda. --- .../com/ishland/flowsched/scheduler/TicketSet.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ishland/flowsched/scheduler/TicketSet.java b/src/main/java/com/ishland/flowsched/scheduler/TicketSet.java index f4117d8..36dfbbf 100644 --- a/src/main/java/com/ishland/flowsched/scheduler/TicketSet.java +++ b/src/main/java/com/ishland/flowsched/scheduler/TicketSet.java @@ -11,11 +11,11 @@ public class TicketSet { private final ItemStatus initialStatus; private final Set>[] status2Tickets; - private volatile int targetStatus = 0; +// private volatile int targetStatus = 0; public TicketSet(ItemStatus initialStatus, ObjectFactory objectFactory) { this.initialStatus = initialStatus; - this.targetStatus = initialStatus.ordinal(); +// this.targetStatus = initialStatus.ordinal(); ItemStatus[] allStatuses = initialStatus.getAllStatuses(); this.status2Tickets = new Set[allStatuses.length]; for (int i = 0; i < allStatuses.length; i++) { @@ -29,8 +29,6 @@ public boolean add(ItemTicket ticket) { final boolean added = this.status2Tickets[targetStatus.ordinal()].add(ticket); if (!added) return false; - this.targetStatus = this.computeTargetStatusSlow(); - // if (this.targetStatus < targetStatus.ordinal()) { // this.targetStatus = targetStatus.ordinal(); // } @@ -43,8 +41,6 @@ public boolean remove(ItemTicket ticket) { final boolean removed = this.status2Tickets[targetStatus.ordinal()].remove(ticket); if (!removed) return false; - this.targetStatus = this.computeTargetStatusSlow(); - // decreaseStatusAtomically(); return true; @@ -69,7 +65,7 @@ public boolean remove(ItemTicket ticket) { // } public ItemStatus getTargetStatus() { - return this.initialStatus.getAllStatuses()[this.targetStatus]; + return this.initialStatus.getAllStatuses()[this.computeTargetStatusSlow()]; } public Set> getTicketsForStatus(ItemStatus status) {