|
16 | 16 |
|
17 | 17 | package org.springframework.boot.web.embedded.tomcat;
|
18 | 18 |
|
19 |
| -import java.lang.reflect.Field; |
20 | 19 | import java.time.Duration;
|
21 | 20 | import java.util.ArrayList;
|
22 | 21 | import java.util.List;
|
23 |
| -import java.util.concurrent.atomic.AtomicLong; |
24 | 22 |
|
25 | 23 | import org.apache.catalina.Container;
|
26 | 24 | import org.apache.catalina.Service;
|
27 | 25 | import org.apache.catalina.connector.Connector;
|
| 26 | +import org.apache.catalina.core.StandardContext; |
28 | 27 | import org.apache.catalina.core.StandardWrapper;
|
29 | 28 | import org.apache.catalina.startup.Tomcat;
|
30 | 29 | import org.apache.commons.logging.Log;
|
31 | 30 | import org.apache.commons.logging.LogFactory;
|
32 | 31 |
|
33 | 32 | import org.springframework.boot.web.server.GracefulShutdown;
|
34 |
| -import org.springframework.util.ReflectionUtils; |
35 | 33 |
|
36 | 34 | /**
|
37 | 35 | * {@link GracefulShutdown} for {@link Tomcat}.
|
@@ -90,10 +88,7 @@ public boolean shutDownGracefully() {
|
90 | 88 |
|
91 | 89 | private boolean active(Container context) {
|
92 | 90 | try {
|
93 |
| - Field field = ReflectionUtils.findField(context.getClass(), "inProgressAsyncCount"); |
94 |
| - field.setAccessible(true); |
95 |
| - AtomicLong inProgressAsyncCount = (AtomicLong) field.get(context); |
96 |
| - if (inProgressAsyncCount.get() > 0) { |
| 91 | + if (((StandardContext) context).getInProgressAsyncCount() > 0) { |
97 | 92 | return true;
|
98 | 93 | }
|
99 | 94 | for (Container wrapper : context.findChildren()) {
|
|
0 commit comments