From 4301edc0f931065a734a70a2954edeebc344c231 Mon Sep 17 00:00:00 2001 From: Oleh Dokuka Date: Tue, 24 Oct 2023 15:51:45 +0300 Subject: [PATCH] ensures proper state is used Signed-off-by: Oleh Dokuka --- .../ThreadPerTaskBoundedElasticScheduler.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/reactor-core/src/main/java21/reactor/core/scheduler/ThreadPerTaskBoundedElasticScheduler.java b/reactor-core/src/main/java21/reactor/core/scheduler/ThreadPerTaskBoundedElasticScheduler.java index 209a2ac679..a8d0b777e7 100644 --- a/reactor-core/src/main/java21/reactor/core/scheduler/ThreadPerTaskBoundedElasticScheduler.java +++ b/reactor-core/src/main/java21/reactor/core/scheduler/ThreadPerTaskBoundedElasticScheduler.java @@ -826,6 +826,10 @@ public boolean isDisposed() { return isShutdown(this.wipAndRefCnt) && numberOfEnqueuedTasks() == 0; } + boolean isShutdown() { + return isShutdown(this.wipAndRefCnt); + } + @Override public Object scanUnsafe(Attr key) { if (Attr.TERMINATED == key) return isDisposed(); @@ -1037,7 +1041,7 @@ public void run() { previousState = isInstant ? markInitial(this) : markRescheduled(this); boolean isDisposed = isDisposed(previousState); - boolean isShutdown = holder.isDisposed(); + boolean isShutdown = holder.isShutdown(); if (isInstant) { if (!isDisposed && !isShutdown) { @@ -1305,8 +1309,11 @@ static void markCompleted(SchedulerTask disposable) { @Override public String toString() { - return "SchedulerTask(" + hashCode() +"){" + "carrier=" + carrier + ", " + - "scheduledFuture=" + scheduledFuture + "state= " + Integer.toBinaryString(get()) + '}'; + return (isPeriodic() ? this.fixedRatePeriod == 0 ? "InstantPeriodic" : + "Periodic" : + "") + + "SchedulerTask(" + hashCode() +"){" + "carrier=" + carrier + ", " + + "scheduledFuture=" + scheduledFuture + ", state= " + Integer.toBinaryString(get()) + '}'; } }