From 1529ba14c831fc9b19e99494239458202de4e4ca Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Wed, 16 Oct 2019 14:57:05 +0200 Subject: [PATCH] Rename server.jetty.idle-timeout This commit renames the `server.jetty.idle-timeout` property to `server.jetty.thread-idle-timeout`, since there are other timeout properties that are not tied to the threadpool configuration (e.g. the connection idle timeout). We might regroup thread-related properties in a dedicated group in the future, see gh-18620. Fixes gh-18615 --- .../boot/autoconfigure/web/ServerProperties.java | 10 +++++----- .../web/embedded/JettyWebServerFactoryCustomizer.java | 2 +- .../boot/autoconfigure/web/ServerPropertiesTests.java | 4 ++-- .../embedded/JettyWebServerFactoryCustomizerTests.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 6af30b33ceb..8448dc0eaef 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -956,7 +956,7 @@ public class ServerProperties { /** * Maximum thread idle time. */ - private Duration idleTimeout = Duration.ofMillis(60000); + private Duration threadIdleTimeout = Duration.ofMillis(60000); /** * Time that the connection can be idle before it is closed. @@ -1007,12 +1007,12 @@ public class ServerProperties { return this.maxThreads; } - public void setIdleTimeout(Duration idleTimeout) { - this.idleTimeout = idleTimeout; + public void setThreadIdleTimeout(Duration threadIdleTimeout) { + this.threadIdleTimeout = threadIdleTimeout; } - public Duration getIdleTimeout() { - return this.idleTimeout; + public Duration getThreadIdleTimeout() { + return this.threadIdleTimeout; } public Duration getConnectionIdleTimeout() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java index 053e871fc3a..bae39ec9c1d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java @@ -86,7 +86,7 @@ public class JettyWebServerFactoryCustomizer .to((maxThreads) -> customizeThreadPool(factory, (threadPool) -> threadPool.setMaxThreads(maxThreads))); propertyMapper.from(jettyProperties::getMinThreads).when(this::isPositive) .to((minThreads) -> customizeThreadPool(factory, (threadPool) -> threadPool.setMinThreads(minThreads))); - propertyMapper.from(jettyProperties::getIdleTimeout).whenNonNull().asInt(Duration::toMillis).to( + propertyMapper.from(jettyProperties::getThreadIdleTimeout).whenNonNull().asInt(Duration::toMillis).to( (idleTimeout) -> customizeThreadPool(factory, (threadPool) -> threadPool.setIdleTimeout(idleTimeout))); propertyMapper.from(properties::getConnectionTimeout).whenNonNull() .to((connectionTimeout) -> customizeIdleTimeout(factory, connectionTimeout)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index db8260ff8a6..2e81a382f24 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -233,8 +233,8 @@ class ServerPropertiesTests { @Test void testCustomizeJettyIdleTimeout() { - bind("server.jetty.idle-timeout", "10s"); - assertThat(this.properties.getJetty().getIdleTimeout()).isEqualTo(Duration.ofSeconds(10)); + bind("server.jetty.thread-idle-timeout", "10s"); + assertThat(this.properties.getJetty().getThreadIdleTimeout()).isEqualTo(Duration.ofSeconds(10)); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java index eafd337ef7a..118dd8bf3c2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java @@ -134,8 +134,8 @@ class JettyWebServerFactoryCustomizerTests { } @Test - void idleTimeoutCanBeCustomized() { - bind("server.jetty.idle-timeout=100s"); + void threadIdleTimeoutCanBeCustomized() { + bind("server.jetty.thread-idle-timeout=100s"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getIdleTimeout()).isEqualTo(100000);