in nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java [417:444]
private static void terminateExecutor(ExecutorService service, String which) {
LOG.log(Level.FINE, "Shutting down {0} ExecutorService", which);
service.shutdown();
boolean terminated;
try {
terminated = service.awaitTermination(TERMINATION_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// It can happen if a thread calling close() is already interrupted
// do not do anything here but do hard shutdown later with shutdownNow()
// It is calling thread's responsibility to not be in interrupted state
LOG.log(
Level.WARNING, "Interruption is signaled in close(), terminating a thread forcefully");
service.shutdownNow();
return;
}
if (!terminated) {
// something went wrong, executor task did not receive a signal and did not complete on time
// shot executor in the head then
LOG.log(
Level.WARNING,
"{0} thread did not unblock on a signal within timeout and will be"
+ " forcefully terminated",
which);
service.shutdownNow();
}
}