Commit 76ad1975 authored by Andy Wilkinson's avatar Andy Wilkinson

Deallocate servlet after forcing initialization in mappings endpoint

Previously, when using Tomcat, a call to mappings endpoint would force
the initialization of any DispatcherServlets in the context. This was
done by calling allocate on Tomcat's StandardWrapper. This left the
wrapper in a state that would cause it to block for two seconds during
shutdown as the wrapper has an outstanding allocation.

This commit immediately deallocates the servlet after it has been
allocated. This ensures that the DispatcherServlet has been initialized
while also leaving the wrapper in a state that it can shut down
immediately when asked to do so.

Closes gh-14898
parent 9b8ead82
...@@ -109,7 +109,8 @@ final class DispatcherServletHandlerMappings { ...@@ -109,7 +109,8 @@ final class DispatcherServletHandlerMappings {
Container child = context.findChild(name); Container child = context.findChild(name);
if (child instanceof StandardWrapper) { if (child instanceof StandardWrapper) {
try { try {
((StandardWrapper) child).allocate(); StandardWrapper wrapper = (StandardWrapper) child;
wrapper.deallocate(wrapper.allocate());
} }
catch (ServletException ex) { catch (ServletException ex) {
// Continue // Continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment