ThreadPoolExecutor.shutdown()和awaitTermination()的阻塞特性

ThreadPoolExecutor.shutdown()不是一个阻塞方法。pool.shutdown()本身的执行很快,执行完后线程池可能仍处于运行中

而awaitTermination()是一个阻塞方法。它必须等线程池退出后才会结束自身。

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.