MCPcopy Create free account
hub / github.com/apache/tomcat / stopInternal

Method stopInternal

java/org/apache/tomcat/util/net/Nio2Endpoint.java:194–228  ·  view source on GitHub ↗

Stop the endpoint. This will cause all processing threads to stop.

()

Source from the content-addressed store, hash-verified

192 * Stop the endpoint. This will cause all processing threads to stop.
193 */
194 @Override
195 public void stopInternal() {
196 if (!paused) {
197 pause();
198 }
199 if (running) {
200 running = false;
201 acceptor.stopMillis(10);
202 // Use the executor to avoid binding the main thread if something bad
203 // occurs and unbind will also wait for a bit for it to complete
204 getExecutor().execute(() -> {
205 // Then close all active connections if any remain
206 try {
207 for (SocketWrapperBase<Nio2Channel> wrapper : getConnections()) {
208 wrapper.close();
209 }
210 } catch (Throwable t) {
211 ExceptionUtils.handleThrowable(t);
212 } finally {
213 allClosed = true;
214 }
215 });
216 if (nioChannels != null) {
217 Nio2Channel socket;
218 while ((socket = nioChannels.pop()) != null) {
219 socket.free();
220 }
221 nioChannels = null;
222 }
223 if (processorCache != null) {
224 processorCache.clear();
225 processorCache = null;
226 }
227 }
228 }
229
230
231 /**

Callers

nothing calls this directly

Calls 10

handleThrowableMethod · 0.95
freeMethod · 0.95
getConnectionsMethod · 0.80
pauseMethod · 0.65
executeMethod · 0.65
getExecutorMethod · 0.65
closeMethod · 0.65
clearMethod · 0.65
stopMillisMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected