2020
09-30
09-30
Java ExcutorService优雅关闭方式解析
关闭时可使用如下代码publicstaticvoidwaitUntilTerminate(finalExecutorServiceexecutorService,finalinttimeout){try{executorService.shutdown();if(!executorService.awaitTermination(timeout,TimeUnit.SECONDS)){//超时后直接关闭executorService.shutdownNow();}}catch(InterruptedExceptione){//awaitTermination出现中断异常也将触发关闭executorService.sh...
继续阅读 >