From 70f7e47002dda3495dabdcf7879a35712f6503fc Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 12 Sep 2019 15:13:31 +0200 Subject: [PATCH] Polish "Use Duration for ServerProperties.Jetty.idleTimeout" See gh-18206 --- .../web/embedded/JettyWebServerFactoryCustomizer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 2c06ee5cc5..7d9bf0ba36 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,9 +86,8 @@ 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() - .to((idleTimeout) -> customizeThreadPool(factory, - (threadPool) -> threadPool.setIdleTimeout((int) idleTimeout.toMillis()))); + propertyMapper.from(jettyProperties::getIdleTimeout).whenNonNull().asInt(Duration::toMillis).to( + (idleTimeout) -> customizeThreadPool(factory, (threadPool) -> threadPool.setIdleTimeout(idleTimeout))); propertyMapper.from(properties::getConnectionTimeout).whenNonNull() .to((connectionTimeout) -> customizeConnectionTimeout(factory, connectionTimeout)); propertyMapper.from(jettyProperties::getAccesslog).when(ServerProperties.Jetty.Accesslog::isEnabled)