@ -66,6 +66,7 @@ import org.springframework.util.unit.DataSize;
* @author Dirk Deyne
* @author Dirk Deyne
* @author HaiTao Zhang
* @author HaiTao Zhang
* @author Victor Mandujano
* @author Victor Mandujano
* @author Chris Bono
* @since 1.0 .0
* @since 1.0 .0
* /
* /
@ConfigurationProperties ( prefix = "server" , ignoreUnknownFields = true )
@ConfigurationProperties ( prefix = "server" , ignoreUnknownFields = true )
@ -316,6 +317,11 @@ public class ServerProperties {
* /
* /
private final Accesslog accesslog = new Accesslog ( ) ;
private final Accesslog accesslog = new Accesslog ( ) ;
/ * *
* Thread related configuration .
* /
private final Threads threads = new Threads ( ) ;
/ * *
/ * *
* Tomcat base directory . If not specified , a temporary directory is used .
* Tomcat base directory . If not specified , a temporary directory is used .
* /
* /
@ -328,16 +334,6 @@ public class ServerProperties {
@DurationUnit ( ChronoUnit . SECONDS )
@DurationUnit ( ChronoUnit . SECONDS )
private Duration backgroundProcessorDelay = Duration . ofSeconds ( 10 ) ;
private Duration backgroundProcessorDelay = Duration . ofSeconds ( 10 ) ;
/ * *
* Maximum amount of worker threads .
* /
private int maxThreads = 200 ;
/ * *
* Minimum amount of worker threads .
* /
private int minSpareThreads = 10 ;
/ * *
/ * *
* Maximum size of the form content in any HTTP post request .
* Maximum size of the form content in any HTTP post request .
* /
* /
@ -425,20 +421,26 @@ public class ServerProperties {
* /
* /
private final Remoteip remoteip = new Remoteip ( ) ;
private final Remoteip remoteip = new Remoteip ( ) ;
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.tomcat.threads.max" )
public int getMaxThreads ( ) {
public int getMaxThreads ( ) {
return this . maxThreads ;
return this . getThreads( ) . getMax ( ) ;
}
}
@Deprecated
public void setMaxThreads ( int maxThreads ) {
public void setMaxThreads ( int maxThreads ) {
this . maxThreads = maxThreads ;
this . getThreads( ) . setMax ( maxThreads ) ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.tomcat.threads.min-spare" )
public int getMinSpareThreads ( ) {
public int getMinSpareThreads ( ) {
return this . minSpareThreads ;
return this . getThreads( ) . getMinSpare ( ) ;
}
}
@Deprecated
public void setMinSpareThreads ( int minSpareThreads ) {
public void setMinSpareThreads ( int minSpareThreads ) {
this . minSpareThreads = minSpareThreads ;
this . getThreads( ) . setMinSpare ( minSpareThreads ) ;
}
}
@Deprecated
@Deprecated
@ -464,6 +466,10 @@ public class ServerProperties {
return this . accesslog ;
return this . accesslog ;
}
}
public Threads getThreads ( ) {
return this . threads ;
}
public Duration getBackgroundProcessorDelay ( ) {
public Duration getBackgroundProcessorDelay ( ) {
return this . backgroundProcessorDelay ;
return this . backgroundProcessorDelay ;
}
}
@ -870,6 +876,39 @@ public class ServerProperties {
}
}
/ * *
* Tomcat thread properties .
* /
public static class Threads {
/ * *
* Maximum amount of worker threads .
* /
private int max = 200 ;
/ * *
* Minimum amount of worker threads .
* /
private int minSpare = 10 ;
public int getMax ( ) {
return this . max ;
}
public void setMax ( int max ) {
this . max = max ;
}
public int getMinSpare ( ) {
return this . minSpare ;
}
public void setMinSpare ( int minSpare ) {
this . minSpare = minSpare ;
}
}
/ * *
/ * *
* Tomcat static resource properties .
* Tomcat static resource properties .
* /
* /
@ -1023,42 +1062,14 @@ public class ServerProperties {
private final Accesslog accesslog = new Accesslog ( ) ;
private final Accesslog accesslog = new Accesslog ( ) ;
/ * *
/ * *
* Maximum size of the form content in any HTTP post request .
* Thread related configuration .
* /
private DataSize maxHttpFormPostSize = DataSize . ofBytes ( 200000 ) ;
/ * *
* Number of acceptor threads to use . When the value is - 1 , the default , the
* number of acceptors is derived from the operating environment .
* /
* /
private Integer acceptors = - 1 ;
private final Threads threads = new Threads ( ) ;
/ * *
/ * *
* Number of selector threads to use . When the value is - 1 , the default , the
* Maximum size of the form content in any HTTP post request .
* number of selectors is derived from the operating environment .
* /
private Integer selectors = - 1 ;
/ * *
* Minimum number of threads .
* /
private int minThreads = 8 ;
/ * *
* Maximum number of threads .
* /
private int maxThreads = 200 ;
/ * *
* Maximum capacity of the thread pool ' s backing queue . A default is computed
* based on the threading configuration .
* /
private Integer maxQueueCapacity ;
/ * *
* Maximum thread idle time .
* /
* /
private D uration threadIdleTimeout = Duration . ofMillis ( 6 0000) ;
private DataSize maxHttpFormPostSize = DataSize . ofBytes ( 200000 ) ;
/ * *
/ * *
* Time that the connection can be idle before it is closed .
* Time that the connection can be idle before it is closed .
@ -1069,6 +1080,10 @@ public class ServerProperties {
return this . accesslog ;
return this . accesslog ;
}
}
public Threads getThreads ( ) {
return this . threads ;
}
@Deprecated
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.jetty.max-http-form-post-size" )
@DeprecatedConfigurationProperty ( replacement = "server.jetty.max-http-form-post-size" )
public DataSize getMaxHttpPostSize ( ) {
public DataSize getMaxHttpPostSize ( ) {
@ -1088,52 +1103,68 @@ public class ServerProperties {
this . maxHttpFormPostSize = maxHttpFormPostSize ;
this . maxHttpFormPostSize = maxHttpFormPostSize ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.acceptors" )
public Integer getAcceptors ( ) {
public Integer getAcceptors ( ) {
return this . acceptors ;
return this . getThre ads( ) . getA cceptors( ) ;
}
}
public void setAcceptors ( Integer acceptors ) {
public void setAcceptors ( Integer acceptors ) {
this . acceptors = acceptors ;
this . getThreads( ) . setAcceptors ( acceptors ) ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.selectors" )
public Integer getSelectors ( ) {
public Integer getSelectors ( ) {
return this . selectors ;
return this . getThread s( ) . getS electors( ) ;
}
}
public void setSelectors ( Integer selectors ) {
public void setSelectors ( Integer selectors ) {
this . selectors = selectors ;
this . getThreads ( ) . setSelectors ( selectors ) ;
}
public void setMinThreads ( int minThreads ) {
this . minThreads = minThreads ;
}
}
public int getMinThreads ( ) {
@Deprecated
return this . minThreads ;
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.min" )
public Integer getMinThreads ( ) {
return this . getThreads ( ) . getMin ( ) ;
}
}
public void setMaxThreads ( int maxThreads ) {
@Deprecated
this . maxThreads = maxThreads ;
public void setMinThreads ( Integer minThreads ) {
this . getThreads ( ) . setMin ( minThreads ) ;
}
}
public int getMaxThreads ( ) {
@Deprecated
return this . maxThreads ;
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.max" )
public Integer getMaxThreads ( ) {
return this . getThreads ( ) . getMax ( ) ;
}
}
public void setMaxQueueCapacity ( Integer maxQueueCapacity ) {
@Deprecated
this . maxQueueCapacity = maxQueueCapacity ;
public void setMaxThreads ( Integer maxThreads ) {
this . getThreads ( ) . setMax ( maxThreads ) ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.max-queue-capacity" )
public Integer getMaxQueueCapacity ( ) {
public Integer getMaxQueueCapacity ( ) {
return this . maxQueueCapacity ;
return this . getThreads( ) . getMaxQueueCapacity ( ) ;
}
}
public void setThreadIdleTimeout ( Duration threadIdleTimeout ) {
@Deprecated
this . threadIdleTimeout = threadIdleTimeout ;
public void setMaxQueueCapacity ( Integer maxQueueCapacity ) {
this . getThreads ( ) . setMaxQueueCapacity ( maxQueueCapacity ) ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.jetty.threads.idle-timeout" )
public Duration getThreadIdleTimeout ( ) {
public Duration getThreadIdleTimeout ( ) {
return this . threadIdleTimeout ;
return this . getThreads ( ) . getIdleTimeout ( ) ;
}
@Deprecated
public void setThreadIdleTimeout ( Duration threadIdleTimeout ) {
this . getThreads ( ) . setIdleTimeout ( threadIdleTimeout ) ;
}
}
public Duration getConnectionIdleTimeout ( ) {
public Duration getConnectionIdleTimeout ( ) {
@ -1274,6 +1305,94 @@ public class ServerProperties {
}
}
/ * *
* Jetty thread properties .
* /
public static class Threads {
/ * *
* Number of acceptor threads to use . When the value is - 1 , the default , the
* number of acceptors is derived from the operating environment .
* /
private Integer acceptors = - 1 ;
/ * *
* Number of selector threads to use . When the value is - 1 , the default , the
* number of selectors is derived from the operating environment .
* /
private Integer selectors = - 1 ;
/ * *
* Maximum number of threads .
* /
private Integer max = 200 ;
/ * *
* Minimum number of threads .
* /
private Integer min = 8 ;
/ * *
* Maximum capacity of the thread pool ' s backing queue . A default is computed
* based on the threading configuration .
* /
private Integer maxQueueCapacity ;
/ * *
* Maximum thread idle time .
* /
private Duration idleTimeout = Duration . ofMillis ( 60000 ) ;
public Integer getAcceptors ( ) {
return this . acceptors ;
}
public void setAcceptors ( Integer acceptors ) {
this . acceptors = acceptors ;
}
public Integer getSelectors ( ) {
return this . selectors ;
}
public void setSelectors ( Integer selectors ) {
this . selectors = selectors ;
}
public void setMin ( Integer min ) {
this . min = min ;
}
public Integer getMin ( ) {
return this . min ;
}
public void setMax ( Integer max ) {
this . max = max ;
}
public Integer getMax ( ) {
return this . max ;
}
public Integer getMaxQueueCapacity ( ) {
return this . maxQueueCapacity ;
}
public void setMaxQueueCapacity ( Integer maxQueueCapacity ) {
this . maxQueueCapacity = maxQueueCapacity ;
}
public void setIdleTimeout ( Duration idleTimeout ) {
this . idleTimeout = idleTimeout ;
}
public Duration getIdleTimeout ( ) {
return this . idleTimeout ;
}
}
}
}
/ * *
/ * *
@ -1313,17 +1432,6 @@ public class ServerProperties {
* /
* /
private DataSize bufferSize ;
private DataSize bufferSize ;
/ * *
* Number of I / O threads to create for the worker . The default is derived from the
* number of available processors .
* /
private Integer ioThreads ;
/ * *
* Number of worker threads . The default is 8 times the number of I / O threads .
* /
private Integer workerThreads ;
/ * *
/ * *
* Whether to allocate buffers outside the Java heap . The default is derived from
* Whether to allocate buffers outside the Java heap . The default is derived from
* the maximum amount of memory that is available to the JVM .
* the maximum amount of memory that is available to the JVM .
@ -1386,6 +1494,11 @@ public class ServerProperties {
private final Accesslog accesslog = new Accesslog ( ) ;
private final Accesslog accesslog = new Accesslog ( ) ;
/ * *
* Thread related configuration .
* /
private final Threads threads = new Threads ( ) ;
private final Options options = new Options ( ) ;
private final Options options = new Options ( ) ;
public DataSize getMaxHttpPostSize ( ) {
public DataSize getMaxHttpPostSize ( ) {
@ -1404,20 +1517,26 @@ public class ServerProperties {
this . bufferSize = bufferSize ;
this . bufferSize = bufferSize ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.undertow.threads.io" )
public Integer getIoThreads ( ) {
public Integer getIoThreads ( ) {
return this . ioThreads ;
return this . getThreads( ) . getIo ( ) ;
}
}
@Deprecated
public void setIoThreads ( Integer ioThreads ) {
public void setIoThreads ( Integer ioThreads ) {
this . ioThreads = ioThreads ;
this . getThreads( ) . setIo ( ioThreads ) ;
}
}
@Deprecated
@DeprecatedConfigurationProperty ( replacement = "server.undertow.threads.worker" )
public Integer getWorkerThreads ( ) {
public Integer getWorkerThreads ( ) {
return this . workerThreads ;
return this . getThreads( ) . getWorker ( ) ;
}
}
@Deprecated
public void setWorkerThreads ( Integer workerThreads ) {
public void setWorkerThreads ( Integer workerThreads ) {
this . workerThreads = workerThreads ;
this . getThreads( ) . setWorker ( workerThreads ) ;
}
}
public Boolean getDirectBuffers ( ) {
public Boolean getDirectBuffers ( ) {
@ -1504,6 +1623,10 @@ public class ServerProperties {
return this . accesslog ;
return this . accesslog ;
}
}
public Threads getThreads ( ) {
return this . threads ;
}
public Options getOptions ( ) {
public Options getOptions ( ) {
return this . options ;
return this . options ;
}
}
@ -1593,6 +1716,40 @@ public class ServerProperties {
}
}
/ * *
* Undertow thread properties .
* /
public static class Threads {
/ * *
* Number of I / O threads to create for the worker . The default is derived from
* the number of available processors .
* /
private Integer io ;
/ * *
* Number of worker threads . The default is 8 times the number of I / O threads .
* /
private Integer worker ;
public Integer getIo ( ) {
return this . io ;
}
public void setIo ( Integer io ) {
this . io = io ;
}
public Integer getWorker ( ) {
return this . worker ;
}
public void setWorker ( Integer worker ) {
this . worker = worker ;
}
}
public static class Options {
public static class Options {
private Map < String , String > socket = new LinkedHashMap < > ( ) ;
private Map < String , String > socket = new LinkedHashMap < > ( ) ;