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
abe3d385
Commit
abe3d385
authored
Aug 21, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OoM error when starting Tomcat with max int load on startup
Fixes gh-17927
parent
ab87b2a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
TomcatEmbeddedContext.java
...ework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java
+1
-2
TomcatServletWebServerFactoryTests.java
...b/embedded/tomcat/TomcatServletWebServerFactoryTests.java
+15
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java
View file @
abe3d385
...
...
@@ -71,8 +71,7 @@ class TomcatEmbeddedContext extends StandardContext {
Wrapper
wrapper
=
(
Wrapper
)
child
;
int
order
=
wrapper
.
getLoadOnStartup
();
if
(
order
>=
0
)
{
grouped
.
computeIfAbsent
(
order
,
ArrayList:
:
new
);
grouped
.
get
(
order
).
add
(
wrapper
);
grouped
.
computeIfAbsent
(
order
,
(
o
)
->
new
ArrayList
<>()).
add
(
wrapper
);
}
}
return
grouped
.
values
().
stream
().
flatMap
(
List:
:
stream
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java
View file @
abe3d385
...
...
@@ -519,6 +519,21 @@ public class TomcatServletWebServerFactoryTests extends AbstractServletWebServer
()
->
factory
.
getWebServer
((
context
)
->
context
.
addListener
(
new
FailingServletContextListener
())));
}
@Test
public
void
registerJspServletWithDefaultLoadOnStartup
()
{
TomcatServletWebServerFactory
factory
=
new
TomcatServletWebServerFactory
(
0
);
factory
.
addInitializers
(
new
ServletContextInitializer
()
{
@Override
public
void
onStartup
(
ServletContext
servletContext
)
throws
ServletException
{
servletContext
.
addServlet
(
"manually-registered-jsp-servlet"
,
JspServlet
.
class
);
}
});
this
.
webServer
=
factory
.
getWebServer
();
this
.
webServer
.
start
();
}
@Override
protected
JspServlet
getJspServlet
()
throws
ServletException
{
Tomcat
tomcat
=
((
TomcatWebServer
)
this
.
webServer
).
getTomcat
();
...
...
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