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
This commit is contained in:
Brian Clozel
2019-10-16 14:57:05 +02:00
parent 49a6131a98
commit 1529ba14c8
4 changed files with 10 additions and 10 deletions

View File

@@ -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() {

View File

@@ -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));

View File

@@ -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

View File

@@ -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);