Skip to content

Commit

Permalink
ensures proper state is used
Browse files Browse the repository at this point in the history
Signed-off-by: Oleh Dokuka <[email protected]>
  • Loading branch information
Oleh Dokuka committed Oct 24, 2023
1 parent d4b271c commit 4301edc
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()) + '}';
}
}

Expand Down

0 comments on commit 4301edc

Please sign in to comment.