優雅的關閉執行緒池
阿新 • • 發佈:2019-01-22
@PreDestroy public void destory() { try { scheduledExecutorService.shutdown(); if (!scheduledExecutorService.awaitTermination(10, TimeUnit.SECONDS)) { scheduledExecutorService.shutdownNow(); } } catch (InterruptedException e) { scheduledExecutorService.shutdownNow(); } }