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

Method stopInternal

java/org/apache/tomcat/util/net/NioEndpoint.java:389–430  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

387 * Stop the endpoint. This will cause all processing threads to stop.
388 */
389 @Override
390 public void stopInternal() {
391 if (!paused) {
392 pause();
393 }
394 if (running) {
395 running = false;
396 /*
397 * Need to wait for the acceptor to unlock but not too long. 100ms plus twice the unlock timeout should be
398 * plenty of time for the acceptor to unlock without being an excessively long wait if the unlock fails.
399 */
400 int acceptorWaitMilliSeconds = 100 + 2 * getSocketProperties().getUnlockTimeout();
401 acceptor.stopMillis(acceptorWaitMilliSeconds);
402 if (poller != null) {
403 poller.destroy();
404 poller = null;
405 }
406 try {
407 if (!getStopLatch().await(selectorTimeout + 100, TimeUnit.MILLISECONDS)) {
408 log.warn(sm.getString("endpoint.nio.stopLatchAwaitFail"));
409 }
410 } catch (InterruptedException e) {
411 log.warn(sm.getString("endpoint.nio.stopLatchAwaitInterrupted"), e);
412 }
413 shutdownExecutor();
414 if (eventCache != null) {
415 eventCache.clear();
416 eventCache = null;
417 }
418 if (nioChannels != null) {
419 NioChannel socket;
420 while ((socket = nioChannels.pop()) != null) {
421 socket.free();
422 }
423 nioChannels = null;
424 }
425 if (processorCache != null) {
426 processorCache.clear();
427 processorCache = null;
428 }
429 }
430 }
431
432
433 /**

Callers

nothing calls this directly

Calls 13

getStopLatchMethod · 0.95
freeMethod · 0.95
getUnlockTimeoutMethod · 0.80
getSocketPropertiesMethod · 0.80
pauseMethod · 0.65
destroyMethod · 0.65
awaitMethod · 0.65
warnMethod · 0.65
getStringMethod · 0.65
clearMethod · 0.65
stopMillisMethod · 0.45
shutdownExecutorMethod · 0.45

Tested by

no test coverage detected