/**
* Attempts to stop all actively executing tasks, halts the
* processing of waiting tasks, and returns a list of the tasks
* that were awaiting execution. These tasks are drained (removed)
* from the task queue upon return from this method.
* 尝试停止所有正在执行的任务,终止等待中的任务,并且返回一个等待执行的任务的list。
* 当此方法返回时,将从任务队列中删除这些任务
* <p>This method does not wait for actively executing tasks to
* terminate. Use {@link #awaitTermination awaitTermination} to
* do that.
* 此方法不会等待正在执行的任务停止,要达到此效果,需使用awaitTermination
* <p>There are no guarantees beyond best-effort attempts to stop
* processing actively executing tasks. This implementation
* cancels tasks via {@link Thread#interrupt}, so any task that
* fails to respond to interrupts may never terminate.
* 此方法只是尽力尝试终止正在执行的任务,并不保证一定能终止。
* 是通过 Thread#interrupt方法来完成取消任务,因此任何不响应中断的任务可能永远不会终止运行
* @t
线程池shutdownNow源码
最新推荐文章于 2023-11-20 07:15:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)