David Smiley created SOLR-9126:
----------------------------------
Summary: shutdownAndAwaitTermination interruption handling faulty?
Key: SOLR-9126
URL: https://issues.apache.org/jira/browse/SOLR-9126
Project: Solr
Issue Type: Bug
Reporter: David Smiley
I'm looking at ExecutorUtil.shutdownAndAwaitTermination:
{code:java}
public static void shutdownAndAwaitTermination(ExecutorService pool) {
pool.shutdown(); // Disable new tasks from being submitted
boolean shutdown = false;
while (!shutdown) {
try {
// Wait a while for existing tasks to terminate
shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
}
{code}
If the current thread calling this method is interrupted, this loop will loop
forever since awaitTermination will likely keep throwing InterruptedException.
If InterruptedException isn't going to be propagated, this method should
return, and probably log that it was interrupted prior to termination.
disclaimer: this is purely from inspection; I haven't seen this happen.
nitpick: the shutdown boolean is needless, simply do if (pool.await...) return;
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]