mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Upgrade to Tomcat 10.1.19
Closes gh-39673
This commit is contained in:
parent
d86fa721b5
commit
71e3a92f3c
@ -14,6 +14,6 @@ kotlinVersion=1.9.22
|
|||||||
mavenVersion=3.9.4
|
mavenVersion=3.9.4
|
||||||
nativeBuildToolsVersion=0.9.28
|
nativeBuildToolsVersion=0.9.28
|
||||||
springFrameworkVersion=6.1.4
|
springFrameworkVersion=6.1.4
|
||||||
tomcatVersion=10.1.18
|
tomcatVersion=10.1.19
|
||||||
|
|
||||||
kotlin.stdlib.default.dependency=false
|
kotlin.stdlib.default.dependency=false
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,6 +19,7 @@ package org.springframework.boot.web.embedded.tomcat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import org.apache.catalina.Container;
|
import org.apache.catalina.Container;
|
||||||
import org.apache.catalina.Service;
|
import org.apache.catalina.Service;
|
||||||
@ -51,12 +52,21 @@ final class GracefulShutdown {
|
|||||||
|
|
||||||
void shutDownGracefully(GracefulShutdownCallback callback) {
|
void shutDownGracefully(GracefulShutdownCallback callback) {
|
||||||
logger.info("Commencing graceful shutdown. Waiting for active requests to complete");
|
logger.info("Commencing graceful shutdown. Waiting for active requests to complete");
|
||||||
new Thread(() -> doShutdown(callback), "tomcat-shutdown").start();
|
CountDownLatch shutdownUnderway = new CountDownLatch(1);
|
||||||
|
new Thread(() -> doShutdown(callback, shutdownUnderway), "tomcat-shutdown").start();
|
||||||
|
try {
|
||||||
|
shutdownUnderway.await();
|
||||||
|
}
|
||||||
|
catch (InterruptedException ex) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doShutdown(GracefulShutdownCallback callback) {
|
private void doShutdown(GracefulShutdownCallback callback, CountDownLatch shutdownUnderway) {
|
||||||
|
try {
|
||||||
List<Connector> connectors = getConnectors();
|
List<Connector> connectors = getConnectors();
|
||||||
connectors.forEach(this::close);
|
connectors.forEach(this::close);
|
||||||
|
shutdownUnderway.countDown();
|
||||||
try {
|
try {
|
||||||
for (Container host : this.tomcat.getEngine().findChildren()) {
|
for (Container host : this.tomcat.getEngine().findChildren()) {
|
||||||
for (Container context : host.findChildren()) {
|
for (Container context : host.findChildren()) {
|
||||||
@ -70,7 +80,6 @@ final class GracefulShutdown {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException ex) {
|
catch (InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
@ -78,6 +87,10 @@ final class GracefulShutdown {
|
|||||||
logger.info("Graceful shutdown complete");
|
logger.info("Graceful shutdown complete");
|
||||||
callback.shutdownComplete(GracefulShutdownResult.IDLE);
|
callback.shutdownComplete(GracefulShutdownResult.IDLE);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
shutdownUnderway.countDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<Connector> getConnectors() {
|
private List<Connector> getConnectors() {
|
||||||
List<Connector> connectors = new ArrayList<>();
|
List<Connector> connectors = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user