开发者

How to join the main thread to a thread pool in java

开发者 https://www.devze.com 2023-03-25 15:13 出处:网络
Like joining two threads using join(), is there a way to join a thread to a ExecutorService object (a thread 开发者_开发问答pool) ?According to the docs, you could, from your second thread, call the s

Like joining two threads using join(), is there a way to join a thread to a ExecutorService object (a thread 开发者_开发问答pool) ?


According to the docs, you could, from your second thread, call the shutdown method of your executor service and next, call for awaitTermination. This method will block till completion of all submitted jobs in the executor service.

0

精彩评论

暂无评论...
验证码 换一张
取 消