Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
5893786c
Commit
5893786c
authored
Mar 19, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Add 'threads' configuration group for embedded containers"
See gh-19475
parent
208f5810
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
47 deletions
+18
-47
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+1
-1
JettyWebServerFactoryCustomizer.java
...nfigure/web/embedded/JettyWebServerFactoryCustomizer.java
+7
-7
TomcatWebServerFactoryCustomizer.java
...figure/web/embedded/TomcatWebServerFactoryCustomizer.java
+1
-1
UndertowWebServerFactoryCustomizer.java
...gure/web/embedded/UndertowWebServerFactoryCustomizer.java
+1
-1
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+0
-29
JettyWebServerFactoryCustomizerTests.java
...re/web/embedded/JettyWebServerFactoryCustomizerTests.java
+7
-7
application.properties
...moke-test-jetty/src/main/resources/application.properties
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
5893786c
...
@@ -1146,7 +1146,7 @@ public class ServerProperties {
...
@@ -1146,7 +1146,7 @@ public class ServerProperties {
}
}
@Deprecated
@Deprecated
@DeprecatedConfigurationProperty
(
replacement
=
"server.jetty.threads.max
QueueC
apacity"
)
@DeprecatedConfigurationProperty
(
replacement
=
"server.jetty.threads.max
-queue-c
apacity"
)
public
Integer
getMaxQueueCapacity
()
{
public
Integer
getMaxQueueCapacity
()
{
return
this
.
getThreads
().
getMaxQueueCapacity
();
return
this
.
getThreads
().
getMaxQueueCapacity
();
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java
View file @
5893786c
...
@@ -76,8 +76,8 @@ public class JettyWebServerFactoryCustomizer
...
@@ -76,8 +76,8 @@ public class JettyWebServerFactoryCustomizer
public
void
customize
(
ConfigurableJettyWebServerFactory
factory
)
{
public
void
customize
(
ConfigurableJettyWebServerFactory
factory
)
{
ServerProperties
properties
=
this
.
serverProperties
;
ServerProperties
properties
=
this
.
serverProperties
;
ServerProperties
.
Jetty
jettyProperties
=
properties
.
getJetty
();
ServerProperties
.
Jetty
jettyProperties
=
properties
.
getJetty
();
ServerProperties
.
Jetty
.
Threads
threadProperties
=
jettyProperties
.
getThreads
();
factory
.
setUseForwardHeaders
(
getOrDeduceUseForwardHeaders
());
factory
.
setUseForwardHeaders
(
getOrDeduceUseForwardHeaders
());
ServerProperties
.
Jetty
.
Threads
threadProperties
=
jettyProperties
.
getThreads
();
factory
.
setThreadPool
(
determineThreadPool
(
jettyProperties
.
getThreads
()));
factory
.
setThreadPool
(
determineThreadPool
(
jettyProperties
.
getThreads
()));
PropertyMapper
propertyMapper
=
PropertyMapper
.
get
();
PropertyMapper
propertyMapper
=
PropertyMapper
.
get
();
propertyMapper
.
from
(
threadProperties:
:
getAcceptors
).
whenNonNull
().
to
(
factory:
:
setAcceptors
);
propertyMapper
.
from
(
threadProperties:
:
getAcceptors
).
whenNonNull
().
to
(
factory:
:
setAcceptors
);
...
@@ -142,12 +142,12 @@ public class JettyWebServerFactoryCustomizer
...
@@ -142,12 +142,12 @@ public class JettyWebServerFactoryCustomizer
});
});
}
}
private
ThreadPool
determineThreadPool
(
ServerProperties
.
Jetty
.
Threads
threadP
roperties
)
{
private
ThreadPool
determineThreadPool
(
ServerProperties
.
Jetty
.
Threads
p
roperties
)
{
BlockingQueue
<
Runnable
>
queue
=
determineBlockingQueue
(
threadP
roperties
.
getMaxQueueCapacity
());
BlockingQueue
<
Runnable
>
queue
=
determineBlockingQueue
(
p
roperties
.
getMaxQueueCapacity
());
int
maxThreadCount
=
(
threadProperties
.
getMax
()
>
0
)
?
threadP
roperties
.
getMax
()
:
200
;
int
maxThreadCount
=
(
properties
.
getMax
()
>
0
)
?
p
roperties
.
getMax
()
:
200
;
int
minThreadCount
=
(
threadProperties
.
getMin
()
>
0
)
?
threadP
roperties
.
getMin
()
:
8
;
int
minThreadCount
=
(
properties
.
getMin
()
>
0
)
?
p
roperties
.
getMin
()
:
8
;
int
threadIdleTimeout
=
(
threadProperties
.
getIdleTimeout
()
!=
null
)
int
threadIdleTimeout
=
(
properties
.
getIdleTimeout
()
!=
null
)
?
(
int
)
properties
.
getIdleTimeout
().
toMillis
(
)
?
(
int
)
threadProperties
.
getIdleTimeout
().
toMillis
()
:
60000
;
:
60000
;
return
new
QueuedThreadPool
(
maxThreadCount
,
minThreadCount
,
threadIdleTimeout
,
queue
);
return
new
QueuedThreadPool
(
maxThreadCount
,
minThreadCount
,
threadIdleTimeout
,
queue
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java
View file @
5893786c
...
@@ -79,12 +79,12 @@ public class TomcatWebServerFactoryCustomizer
...
@@ -79,12 +79,12 @@ public class TomcatWebServerFactoryCustomizer
public
void
customize
(
ConfigurableTomcatWebServerFactory
factory
)
{
public
void
customize
(
ConfigurableTomcatWebServerFactory
factory
)
{
ServerProperties
properties
=
this
.
serverProperties
;
ServerProperties
properties
=
this
.
serverProperties
;
ServerProperties
.
Tomcat
tomcatProperties
=
properties
.
getTomcat
();
ServerProperties
.
Tomcat
tomcatProperties
=
properties
.
getTomcat
();
ServerProperties
.
Tomcat
.
Threads
threadProperties
=
tomcatProperties
.
getThreads
();
PropertyMapper
propertyMapper
=
PropertyMapper
.
get
();
PropertyMapper
propertyMapper
=
PropertyMapper
.
get
();
propertyMapper
.
from
(
tomcatProperties:
:
getBasedir
).
whenNonNull
().
to
(
factory:
:
setBaseDirectory
);
propertyMapper
.
from
(
tomcatProperties:
:
getBasedir
).
whenNonNull
().
to
(
factory:
:
setBaseDirectory
);
propertyMapper
.
from
(
tomcatProperties:
:
getBackgroundProcessorDelay
).
whenNonNull
().
as
(
Duration:
:
getSeconds
)
propertyMapper
.
from
(
tomcatProperties:
:
getBackgroundProcessorDelay
).
whenNonNull
().
as
(
Duration:
:
getSeconds
)
.
as
(
Long:
:
intValue
).
to
(
factory:
:
setBackgroundProcessorDelay
);
.
as
(
Long:
:
intValue
).
to
(
factory:
:
setBackgroundProcessorDelay
);
customizeRemoteIpValve
(
factory
);
customizeRemoteIpValve
(
factory
);
ServerProperties
.
Tomcat
.
Threads
threadProperties
=
tomcatProperties
.
getThreads
();
propertyMapper
.
from
(
threadProperties:
:
getMax
).
when
(
this
::
isPositive
)
propertyMapper
.
from
(
threadProperties:
:
getMax
).
when
(
this
::
isPositive
)
.
to
((
maxThreads
)
->
customizeMaxThreads
(
factory
,
threadProperties
.
getMax
()));
.
to
((
maxThreads
)
->
customizeMaxThreads
(
factory
,
threadProperties
.
getMax
()));
propertyMapper
.
from
(
threadProperties:
:
getMinSpare
).
when
(
this
::
isPositive
)
propertyMapper
.
from
(
threadProperties:
:
getMinSpare
).
when
(
this
::
isPositive
)
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizer.java
View file @
5893786c
...
@@ -88,8 +88,8 @@ public class UndertowWebServerFactoryCustomizer
...
@@ -88,8 +88,8 @@ public class UndertowWebServerFactoryCustomizer
private
void
mapUndertowProperties
(
ConfigurableUndertowWebServerFactory
factory
,
FactoryOptions
options
)
{
private
void
mapUndertowProperties
(
ConfigurableUndertowWebServerFactory
factory
,
FactoryOptions
options
)
{
PropertyMapper
map
=
PropertyMapper
.
get
().
alwaysApplyingWhenNonNull
();
PropertyMapper
map
=
PropertyMapper
.
get
().
alwaysApplyingWhenNonNull
();
Undertow
properties
=
this
.
serverProperties
.
getUndertow
();
Undertow
properties
=
this
.
serverProperties
.
getUndertow
();
ServerProperties
.
Undertow
.
Threads
threadProperties
=
properties
.
getThreads
();
map
.
from
(
properties:
:
getBufferSize
).
whenNonNull
().
asInt
(
DataSize:
:
toBytes
).
to
(
factory:
:
setBufferSize
);
map
.
from
(
properties:
:
getBufferSize
).
whenNonNull
().
asInt
(
DataSize:
:
toBytes
).
to
(
factory:
:
setBufferSize
);
ServerProperties
.
Undertow
.
Threads
threadProperties
=
properties
.
getThreads
();
map
.
from
(
threadProperties:
:
getIo
).
to
(
factory:
:
setIoThreads
);
map
.
from
(
threadProperties:
:
getIo
).
to
(
factory:
:
setIoThreads
);
map
.
from
(
threadProperties:
:
getWorker
).
to
(
factory:
:
setWorkerThreads
);
map
.
from
(
threadProperties:
:
getWorker
).
to
(
factory:
:
setWorkerThreads
);
map
.
from
(
properties:
:
getDirectBuffers
).
to
(
factory:
:
setUseDirectBuffers
);
map
.
from
(
properties:
:
getDirectBuffers
).
to
(
factory:
:
setUseDirectBuffers
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
5893786c
...
@@ -219,9 +219,6 @@ class ServerPropertiesTests {
...
@@ -219,9 +219,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeTomcatMaxThreadsDeprecated
()
{
void
testCustomizeTomcatMaxThreadsDeprecated
()
{
bind
(
"server.tomcat.maxThreads"
,
"10"
);
bind
(
"server.tomcat.maxThreads"
,
"10"
);
assertThat
(
this
.
properties
.
getTomcat
().
getMaxThreads
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getTomcat
().
getThreads
().
getMax
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getTomcat
().
getThreads
().
getMax
()).
isEqualTo
(
10
);
}
}
...
@@ -235,9 +232,6 @@ class ServerPropertiesTests {
...
@@ -235,9 +232,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeTomcatMinSpareThreadsDeprecated
()
{
void
testCustomizeTomcatMinSpareThreadsDeprecated
()
{
bind
(
"server.tomcat.min-spare-threads"
,
"10"
);
bind
(
"server.tomcat.min-spare-threads"
,
"10"
);
assertThat
(
this
.
properties
.
getTomcat
().
getMinSpareThreads
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getTomcat
().
getThreads
().
getMinSpare
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getTomcat
().
getThreads
().
getMinSpare
()).
isEqualTo
(
10
);
}
}
...
@@ -251,9 +245,6 @@ class ServerPropertiesTests {
...
@@ -251,9 +245,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeJettyAcceptorsDeprecated
()
{
void
testCustomizeJettyAcceptorsDeprecated
()
{
bind
(
"server.jetty.acceptors"
,
"10"
);
bind
(
"server.jetty.acceptors"
,
"10"
);
assertThat
(
this
.
properties
.
getJetty
().
getAcceptors
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getAcceptors
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getAcceptors
()).
isEqualTo
(
10
);
}
}
...
@@ -268,8 +259,6 @@ class ServerPropertiesTests {
...
@@ -268,8 +259,6 @@ class ServerPropertiesTests {
void
testCustomizeJettySelectorsDeprecated
()
{
void
testCustomizeJettySelectorsDeprecated
()
{
bind
(
"server.jetty.selectors"
,
"10"
);
bind
(
"server.jetty.selectors"
,
"10"
);
assertThat
(
this
.
properties
.
getJetty
().
getSelectors
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getSelectors
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getSelectors
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getSelectors
()).
isEqualTo
(
10
);
}
}
...
@@ -283,9 +272,6 @@ class ServerPropertiesTests {
...
@@ -283,9 +272,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeJettyMaxThreadsDeprecated
()
{
void
testCustomizeJettyMaxThreadsDeprecated
()
{
bind
(
"server.jetty.maxThreads"
,
"10"
);
bind
(
"server.jetty.maxThreads"
,
"10"
);
assertThat
(
this
.
properties
.
getJetty
().
getMaxThreads
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMax
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMax
()).
isEqualTo
(
10
);
}
}
...
@@ -299,9 +285,6 @@ class ServerPropertiesTests {
...
@@ -299,9 +285,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeJettyMinThreadsDeprecated
()
{
void
testCustomizeJettyMinThreadsDeprecated
()
{
bind
(
"server.jetty.minThreads"
,
"10"
);
bind
(
"server.jetty.minThreads"
,
"10"
);
assertThat
(
this
.
properties
.
getJetty
().
getMinThreads
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMin
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMin
()).
isEqualTo
(
10
);
}
}
...
@@ -315,9 +298,6 @@ class ServerPropertiesTests {
...
@@ -315,9 +298,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeJettyIdleTimeoutDeprecated
()
{
void
testCustomizeJettyIdleTimeoutDeprecated
()
{
bind
(
"server.jetty.thread-idle-timeout"
,
"10s"
);
bind
(
"server.jetty.thread-idle-timeout"
,
"10s"
);
assertThat
(
this
.
properties
.
getJetty
().
getThreadIdleTimeout
()).
isEqualTo
(
Duration
.
ofSeconds
(
10
));
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getIdleTimeout
()).
hasSeconds
(
10
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getIdleTimeout
()).
hasSeconds
(
10
);
}
}
...
@@ -331,9 +311,6 @@ class ServerPropertiesTests {
...
@@ -331,9 +311,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeJettyMaxQueueCapacityDeprecated
()
{
void
testCustomizeJettyMaxQueueCapacityDeprecated
()
{
bind
(
"server.jetty.max-queue-capacity"
,
"5150"
);
bind
(
"server.jetty.max-queue-capacity"
,
"5150"
);
assertThat
(
this
.
properties
.
getJetty
().
getMaxQueueCapacity
()).
isEqualTo
(
5150
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMaxQueueCapacity
()).
isEqualTo
(
5150
);
assertThat
(
this
.
properties
.
getJetty
().
getThreads
().
getMaxQueueCapacity
()).
isEqualTo
(
5150
);
}
}
...
@@ -361,9 +338,6 @@ class ServerPropertiesTests {
...
@@ -361,9 +338,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeUndertowIoThreadsDeprecated
()
{
void
testCustomizeUndertowIoThreadsDeprecated
()
{
bind
(
"server.undertow.ioThreads"
,
"4"
);
bind
(
"server.undertow.ioThreads"
,
"4"
);
assertThat
(
this
.
properties
.
getUndertow
().
getIoThreads
()).
isEqualTo
(
4
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getUndertow
().
getThreads
().
getIo
()).
isEqualTo
(
4
);
assertThat
(
this
.
properties
.
getUndertow
().
getThreads
().
getIo
()).
isEqualTo
(
4
);
}
}
...
@@ -377,9 +351,6 @@ class ServerPropertiesTests {
...
@@ -377,9 +351,6 @@ class ServerPropertiesTests {
@Test
@Test
void
testCustomizeUndertowWorkerThreadsDeprecated
()
{
void
testCustomizeUndertowWorkerThreadsDeprecated
()
{
bind
(
"server.undertow.workerThreads"
,
"10"
);
bind
(
"server.undertow.workerThreads"
,
"10"
);
assertThat
(
this
.
properties
.
getUndertow
().
getWorkerThreads
()).
isEqualTo
(
10
);
// Verify they are locked on same backing props to avoid further downstream
// deprecated testing
assertThat
(
this
.
properties
.
getUndertow
().
getThreads
().
getWorker
()).
isEqualTo
(
10
);
assertThat
(
this
.
properties
.
getUndertow
().
getThreads
().
getWorker
()).
isEqualTo
(
10
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java
View file @
5893786c
...
@@ -179,7 +179,7 @@ class JettyWebServerFactoryCustomizerTests {
...
@@ -179,7 +179,7 @@ class JettyWebServerFactoryCustomizerTests {
@Test
@Test
void
threadPoolIdleTimeoutCanBeCustomized
()
{
void
threadPoolIdleTimeoutCanBeCustomized
()
{
bind
(
"server.jetty.thread
-
idle-timeout=100s"
);
bind
(
"server.jetty.thread
s.
idle-timeout=100s"
);
JettyWebServer
server
=
customizeAndGetServer
();
JettyWebServer
server
=
customizeAndGetServer
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
assertThat
(
threadPool
.
getIdleTimeout
()).
isEqualTo
(
100000
);
assertThat
(
threadPool
.
getIdleTimeout
()).
isEqualTo
(
100000
);
...
@@ -187,7 +187,7 @@ class JettyWebServerFactoryCustomizerTests {
...
@@ -187,7 +187,7 @@ class JettyWebServerFactoryCustomizerTests {
@Test
@Test
void
threadPoolWithMaxQueueCapacityEqualToZeroCreateSynchronousQueue
()
{
void
threadPoolWithMaxQueueCapacityEqualToZeroCreateSynchronousQueue
()
{
bind
(
"server.jetty.max-queue-capacity=0"
);
bind
(
"server.jetty.
threads.
max-queue-capacity=0"
);
JettyWebServer
server
=
customizeAndGetServer
();
JettyWebServer
server
=
customizeAndGetServer
();
ThreadPool
threadPool
=
server
.
getServer
().
getThreadPool
();
ThreadPool
threadPool
=
server
.
getServer
().
getThreadPool
();
BlockingQueue
<?>
queue
=
getQueue
(
threadPool
);
BlockingQueue
<?>
queue
=
getQueue
(
threadPool
);
...
@@ -197,8 +197,8 @@ class JettyWebServerFactoryCustomizerTests {
...
@@ -197,8 +197,8 @@ class JettyWebServerFactoryCustomizerTests {
@Test
@Test
void
threadPoolWithMaxQueueCapacityEqualToZeroCustomizesThreadPool
()
{
void
threadPoolWithMaxQueueCapacityEqualToZeroCustomizesThreadPool
()
{
bind
(
"server.jetty.
max-queue-capacity=0"
,
"server.jetty.min-threads=100"
,
"server.jetty.max
-threads=100"
,
bind
(
"server.jetty.
threads.max-queue-capacity=0"
,
"server.jetty.min
-threads=100"
,
"server.jetty.
thread-
idle-timeout=6s"
);
"server.jetty.
max-threads=100"
,
"server.jetty.threads.
idle-timeout=6s"
);
JettyWebServer
server
=
customizeAndGetServer
();
JettyWebServer
server
=
customizeAndGetServer
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
assertThat
(
threadPool
.
getMinThreads
()).
isEqualTo
(
100
);
assertThat
(
threadPool
.
getMinThreads
()).
isEqualTo
(
100
);
...
@@ -208,7 +208,7 @@ class JettyWebServerFactoryCustomizerTests {
...
@@ -208,7 +208,7 @@ class JettyWebServerFactoryCustomizerTests {
@Test
@Test
void
threadPoolWithMaxQueueCapacityPositiveCreateBlockingArrayQueue
()
{
void
threadPoolWithMaxQueueCapacityPositiveCreateBlockingArrayQueue
()
{
bind
(
"server.jetty.max-queue-capacity=1234"
);
bind
(
"server.jetty.
threads.
max-queue-capacity=1234"
);
JettyWebServer
server
=
customizeAndGetServer
();
JettyWebServer
server
=
customizeAndGetServer
();
ThreadPool
threadPool
=
server
.
getServer
().
getThreadPool
();
ThreadPool
threadPool
=
server
.
getServer
().
getThreadPool
();
BlockingQueue
<?>
queue
=
getQueue
(
threadPool
);
BlockingQueue
<?>
queue
=
getQueue
(
threadPool
);
...
@@ -219,8 +219,8 @@ class JettyWebServerFactoryCustomizerTests {
...
@@ -219,8 +219,8 @@ class JettyWebServerFactoryCustomizerTests {
@Test
@Test
void
threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool
()
{
void
threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool
()
{
bind
(
"server.jetty.
max-queue-capacity=1234"
,
"server.jetty.min-threads=10"
,
"server.jetty.max-threads=15
0"
,
bind
(
"server.jetty.
threads.max-queue-capacity=1234"
,
"server.jetty.min-threads=1
0"
,
"server.jetty.
thread-
idle-timeout=3s"
);
"server.jetty.
max-threads=150"
,
"server.jetty.threads.
idle-timeout=3s"
);
JettyWebServer
server
=
customizeAndGetServer
();
JettyWebServer
server
=
customizeAndGetServer
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
assertThat
(
threadPool
.
getMinThreads
()).
isEqualTo
(
10
);
assertThat
(
threadPool
.
getMinThreads
()).
isEqualTo
(
10
);
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty/src/main/resources/application.properties
View file @
5893786c
server.compression.enabled
:
true
server.compression.enabled
:
true
server.compression.min-response-size
:
1
server.compression.min-response-size
:
1
server.jetty.acceptors
=
2
server.jetty.
threads.
acceptors
=
2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment