1

java | 线程池停止

 1 year ago
source link: https://benpaodewoniu.github.io/2023/01/02/java161/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

关闭线程池。

shutdown

  • 线程池状态变为 SHUTDOWN
  • 不会接收新任务
  • 但是已提交的任务会执行完
  • 此方法不会阻塞调用线程的执行
void shutdown()

shutdownnow

  • 线程池变为 STOP
  • 不会接收新任务
  • 会将队列的任务返回
  • 并用 interrupt 的方式中断正在执行的任务

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK