java.util.concurrent.ExecutorServiceの停止方法
まぁ、JavaDocに書いてあるんですが、すぐに「あれどこに書いてあったっけ?」と忘れるのでメモ。
executor.shutdown(); try { if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { executor.shutdownNow(); if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { System.out.println("ExecutorService did not terminate"); } } } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); }