Unlike ExecutorService
with awaitTermination()
, dispose()
in Scheduler in Reactor just invokes shutdownNow()
when disposing; so how to shutdown Scheduler gracefully?
Sometimes we want to terminate our executorService with all submitted tasks completed:
// in java
executorService.shutdown();
int retry =3;
while(executorService.isTerminated() && retry-- >0){
executorService.awaitTermination(3, TimieUnit.SECONDS);
}
if(!executorService.isTerminated()){
executorService.shutdownNow();
}
As a rookie in Reactor, the only way for me to shutdown scheduler is invoking Scheduler.dispose()
. But it seems that implements for Scheduler, such as Scheduler.BoundedElasticScheduler
,
just invokes executor.shutdownNow()
to interrupt the inner workers, and ignore the state of submitted tasks. How can I gracefully shutdown the Scheduler until all the tasks complete?