Workaround for NPE on ExecutorService.shutdownNow()

This commit is contained in:
Trustin Lee 2008-12-06 14:35:13 +00:00
parent 414e02cb3e
commit f7e7d8f524

View File

@ -57,7 +57,12 @@ public class ExecutorShutdownUtil {
ExecutorService es = (ExecutorService) e;
for (;;) {
try {
es.shutdownNow();
} catch (NullPointerException ex) {
// Some JDK throws NPE here, but shouldn't.
}
try {
if (es.awaitTermination(1, TimeUnit.SECONDS)) {
break;