-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use shutdown() instead of shutdownNow() when BoundedElasticScheduler call dispose. #3068
Copy link
Copy link
Closed
Labels
status/need-decisionThis needs a decision from the teamThis needs a decision from the teamtype/enhancementA general enhancementA general enhancement
Milestone
Description
I post hundreds of http request task with block() to scheduler. Sometimes I need to close my application and dispose the scheduler, then it'll throw interruptedException when each task get http response and notice the scheduler is disposed.
I'm wondering why not use shutdown() instead of shutdownNow() in dispose()?
reactor-core/reactor-core/src/main/java/reactor/core/scheduler/BoundedElasticScheduler.java
Lines 196 to 206 in 8909005
| @Override | |
| public void dispose() { | |
| BoundedServices services = BOUNDED_SERVICES.get(this); | |
| if (services != SHUTDOWN && BOUNDED_SERVICES.compareAndSet(this, services, SHUTDOWN)) { | |
| ScheduledExecutorService e = EVICTOR.getAndSet(this, null); | |
| if (e != null) { | |
| e.shutdownNow(); | |
| } | |
| services.dispose(); | |
| } | |
| } |
Motivation
Currently when BoundedElasticScheduler call dispose(), it will halt all waiting tasks. Let waiting task finish not halt them toughly.
Desired solution
Use shutdown() instead of shutdownNow() in dispose().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status/need-decisionThis needs a decision from the teamThis needs a decision from the teamtype/enhancementA general enhancementA general enhancement