Merge branch '3.2.x'
This commit is contained in:
commit
f16d940081
|
@ -67,25 +67,15 @@ final class GracefulShutdown {
|
|||
List<Connector> connectors = getConnectors();
|
||||
connectors.forEach(this::close);
|
||||
shutdownUnderway.countDown();
|
||||
try {
|
||||
for (Container host : this.tomcat.getEngine().findChildren()) {
|
||||
for (Container context : host.findChildren()) {
|
||||
while (!this.aborted && isActive(context)) {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
if (this.aborted) {
|
||||
logger.info("Graceful shutdown aborted with one or more requests still active");
|
||||
callback.shutdownComplete(GracefulShutdownResult.REQUESTS_ACTIVE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
awaitInactiveOrAborted();
|
||||
if (this.aborted) {
|
||||
logger.info("Graceful shutdown aborted with one or more requests still active");
|
||||
callback.shutdownComplete(GracefulShutdownResult.REQUESTS_ACTIVE);
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
else {
|
||||
logger.info("Graceful shutdown complete");
|
||||
callback.shutdownComplete(GracefulShutdownResult.IDLE);
|
||||
}
|
||||
logger.info("Graceful shutdown complete");
|
||||
callback.shutdownComplete(GracefulShutdownResult.IDLE);
|
||||
}
|
||||
finally {
|
||||
shutdownUnderway.countDown();
|
||||
|
@ -105,6 +95,22 @@ final class GracefulShutdown {
|
|||
connector.getProtocolHandler().closeServerSocketGraceful();
|
||||
}
|
||||
|
||||
private void awaitInactiveOrAborted() {
|
||||
try {
|
||||
for (Container host : this.tomcat.getEngine().findChildren()) {
|
||||
for (Container context : host.findChildren()) {
|
||||
while (!this.aborted && isActive(context)) {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isActive(Container context) {
|
||||
try {
|
||||
if (((StandardContext) context).getInProgressAsyncCount() > 0) {
|
||||
|
|
Loading…
Reference in New Issue