Skip to content

Commit

Permalink
Scheduler.isDisposed() only true for disposed instances (#3243)
Browse files Browse the repository at this point in the history
Some schedulers for optimization purposes started in a state
which was considered as disposed (Scheduler#isDisposed()).
This change affects only BoundedElasticScheduler as it was
the last one which behaved this way.
This is a change of behavior, however one which was not documented.
  • Loading branch information
chemicL committed Oct 21, 2022
1 parent 02b1c6a commit 593c68a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ BoundedScheduledExecutorService createBoundedExecutorService() {

@Override
public boolean isDisposed() {
return state.currentResource == SHUTDOWN;
// we only consider disposed as actually shutdown
SchedulerState<BoundedServices> current = this.state;
return current != INIT && current.currentResource == SHUTDOWN;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ protected boolean isTerminated(Scheduler s) {
}

@Test
@Disabled("Should be enabled in 3.5.0")
void nonInitializedIsNotDisposed() {
Scheduler s = freshScheduler();
assertThat(s.isDisposed()).isFalse();
Expand Down

0 comments on commit 593c68a

Please sign in to comment.