|
|
|
@ -72,6 +72,7 @@ import org.springframework.util.StringUtils; |
|
|
|
* @author Ivan Sopov |
|
|
|
* @author Ivan Sopov |
|
|
|
* @author Marcos Barbero |
|
|
|
* @author Marcos Barbero |
|
|
|
* @author Eddú Meléndez |
|
|
|
* @author Eddú Meléndez |
|
|
|
|
|
|
|
* @author Quinten De Swaef |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) |
|
|
|
@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) |
|
|
|
public class ServerProperties |
|
|
|
public class ServerProperties |
|
|
|
@ -580,6 +581,11 @@ public class ServerProperties |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private int maxThreads = 0; // Number of threads in protocol handler
|
|
|
|
private int maxThreads = 0; // Number of threads in protocol handler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Minimum amount of worker threads. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private int minSpareThreads = 0; // Minimum spare threads in protocol handler
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Maximum size in bytes of the HTTP message header. |
|
|
|
* Maximum size in bytes of the HTTP message header. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -598,6 +604,14 @@ public class ServerProperties |
|
|
|
this.maxThreads = maxThreads; |
|
|
|
this.maxThreads = maxThreads; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMinSpareThreads() { |
|
|
|
|
|
|
|
return this.minSpareThreads; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setMinSpareThreads(int minSpareThreads) { |
|
|
|
|
|
|
|
this.minSpareThreads = minSpareThreads; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getMaxHttpHeaderSize() { |
|
|
|
public int getMaxHttpHeaderSize() { |
|
|
|
return this.maxHttpHeaderSize; |
|
|
|
return this.maxHttpHeaderSize; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -684,6 +698,9 @@ public class ServerProperties |
|
|
|
if (this.maxThreads > 0) { |
|
|
|
if (this.maxThreads > 0) { |
|
|
|
customizeMaxThreads(factory); |
|
|
|
customizeMaxThreads(factory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minSpareThreads > 0) { |
|
|
|
|
|
|
|
customizeMinThreads(factory); |
|
|
|
|
|
|
|
} |
|
|
|
if (this.maxHttpHeaderSize > 0) { |
|
|
|
if (this.maxHttpHeaderSize > 0) { |
|
|
|
customizeMaxHttpHeaderSize(factory); |
|
|
|
customizeMaxHttpHeaderSize(factory); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -747,6 +764,22 @@ public class ServerProperties |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
|
|
|
|
private void customizeMinThreads(TomcatEmbeddedServletContainerFactory factory) { |
|
|
|
|
|
|
|
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void customize(Connector connector) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProtocolHandler handler = connector.getProtocolHandler(); |
|
|
|
|
|
|
|
if (handler instanceof AbstractProtocol) { |
|
|
|
|
|
|
|
AbstractProtocol protocol = (AbstractProtocol) handler; |
|
|
|
|
|
|
|
protocol.setMinSpareThreads(Tomcat.this.minSpareThreads); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
private void customizeMaxHttpHeaderSize( |
|
|
|
private void customizeMaxHttpHeaderSize( |
|
|
|
TomcatEmbeddedServletContainerFactory factory) { |
|
|
|
TomcatEmbeddedServletContainerFactory factory) { |
|
|
|
|