From 234b4719c6551a0761eb3fae6d1a6e4806d7638b Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Fri, 8 Jan 2021 14:32:49 +0100 Subject: [PATCH] Use default bounded elastic scheduler Instead of using a new bounded elastic scheduler per DefaultPartHttpMessageReader instance, which creates daemon threads that are not shut down, we now use the shared bounded elastic scheduler. Closes gh-26347 --- .../codec/multipart/DefaultPartHttpMessageReader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultPartHttpMessageReader.java b/spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultPartHttpMessageReader.java index 51ed268761f..175c7cdbedd 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultPartHttpMessageReader.java +++ b/spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultPartHttpMessageReader.java @@ -74,8 +74,7 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements private boolean streaming; - private Scheduler blockingOperationScheduler = Schedulers.newBoundedElastic(Schedulers.DEFAULT_BOUNDED_ELASTIC_SIZE, - Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, IDENTIFIER, 60, true); + private Scheduler blockingOperationScheduler = Schedulers.boundedElastic(); private Mono fileStorageDirectory = Mono.defer(this::defaultFileStorageDirectory).cache(); @@ -153,8 +152,9 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements /** * Sets the Reactor {@link Scheduler} to be used for creating files and - * directories, and writing to files. By default, a bounded scheduler is - * created with default properties. + * directories, and writing to files. By default, + * {@link Schedulers#boundedElastic()} is used, but this property allows for + * changing it to an externally managed scheduler. *

Note that this property is ignored when * {@linkplain #setStreaming(boolean) streaming} is enabled, or when * {@link #setMaxInMemorySize(int) maxInMemorySize} is set to -1.