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
96019362
Commit
96019362
authored
Sep 11, 2019
by
Johnny Lim
Committed by
Stephane Nicoll
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Duration for ServerProperties.Jetty.idleTimeout
See gh-18206
parent
d86c72bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
+10
-9
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+3
-3
JettyWebServerFactoryCustomizer.java
...nfigure/web/embedded/JettyWebServerFactoryCustomizer.java
+3
-2
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+2
-2
JettyWebServerFactoryCustomizerTests.java
...re/web/embedded/JettyWebServerFactoryCustomizerTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
96019362
...
...
@@ -919,7 +919,7 @@ public class ServerProperties {
/**
* Maximum thread idle time.
*/
private
Integer
idleTimeout
=
60000
;
private
Duration
idleTimeout
=
Duration
.
ofMillis
(
60000
)
;
public
Accesslog
getAccesslog
()
{
return
this
.
accesslog
;
...
...
@@ -965,11 +965,11 @@ public class ServerProperties {
return
this
.
maxThreads
;
}
public
void
setIdleTimeout
(
Integer
idleTimeout
)
{
public
void
setIdleTimeout
(
Duration
idleTimeout
)
{
this
.
idleTimeout
=
idleTimeout
;
}
public
Integer
getIdleTimeout
()
{
public
Duration
getIdleTimeout
()
{
return
this
.
idleTimeout
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java
View file @
96019362
...
...
@@ -86,8 +86,9 @@ 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
).
when
(
this
::
isPositive
).
to
(
(
idleTimeout
)
->
customizeThreadPool
(
factory
,
(
threadPool
)
->
threadPool
.
setIdleTimeout
(
idleTimeout
)));
propertyMapper
.
from
(
jettyProperties:
:
getIdleTimeout
).
whenNonNull
()
.
to
((
idleTimeout
)
->
customizeThreadPool
(
factory
,
(
threadPool
)
->
threadPool
.
setIdleTimeout
((
int
)
idleTimeout
.
toMillis
())));
propertyMapper
.
from
(
properties:
:
getConnectionTimeout
).
whenNonNull
()
.
to
((
connectionTimeout
)
->
customizeConnectionTimeout
(
factory
,
connectionTimeout
));
propertyMapper
.
from
(
jettyProperties:
:
getAccesslog
).
when
(
ServerProperties
.
Jetty
.
Accesslog
::
isEnabled
)
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
96019362
...
...
@@ -233,8 +233,8 @@ class ServerPropertiesTests {
@Test
void
testCustomizeJettyIdleTimeout
()
{
bind
(
"server.jetty.idle-timeout"
,
"10"
);
assertThat
(
this
.
properties
.
getJetty
().
getIdleTimeout
()).
isEqualTo
(
10
);
bind
(
"server.jetty.idle-timeout"
,
"10
s
"
);
assertThat
(
this
.
properties
.
getJetty
().
getIdleTimeout
()).
isEqualTo
(
Duration
.
ofSeconds
(
10
)
);
}
@Test
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java
View file @
96019362
...
...
@@ -132,10 +132,10 @@ class JettyWebServerFactoryCustomizerTests {
@Test
void
idleTimeoutCanBeCustomized
()
{
bind
(
"server.jetty.idle-timeout=100"
);
bind
(
"server.jetty.idle-timeout=100
s
"
);
JettyWebServer
server
=
customizeAndGetServer
();
QueuedThreadPool
threadPool
=
(
QueuedThreadPool
)
server
.
getServer
().
getThreadPool
();
assertThat
(
threadPool
.
getIdleTimeout
()).
isEqualTo
(
100
);
assertThat
(
threadPool
.
getIdleTimeout
()).
isEqualTo
(
100
000
);
}
private
CustomRequestLog
getRequestLog
(
JettyWebServer
server
)
{
...
...
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