• 【多线程】线程池关闭


    shutdown(): 已添加的任务会继续执行完毕,但是不会阻塞;新任务无法继续添加

    • Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.

      This method does not wait for previously submitted tasks to complete execution. Use awaitTermination to do that.

    public List<Runnable> shutdownNow(): 在调用shutdownNow()方法后,线程池会立即关闭,未执行的任务会以列表的形式返回。

      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.

      This method does not wait for actively executing tasks to terminate. Use awaitTermination to do that.

      There are no guarantees beyond best-effort attempts to stop processing actively executing tasks. This implementation cancels tasks via Thread.interrupt(), so any task that fails to respond to interrupts may never terminate.

    awaitTermination


    shutdownNow

      

     shutdown: 原有任务继续执行完毕,新任务无法继续执行

      

  • 相关阅读:
    oracle 索引
    oracle 子查询因子化 浅谈(with的使用)
    大数据的遐想
    数据挖掘(算法概要链接)
    orcale 修改字段属性
    sql 对一张表进行按照不同条件进行多次统计
    oracle dblink
    oracle作业
    SQL效率的几点心得
    提高SQL语句的性能
  • 原文地址:https://www.cnblogs.com/clarino/p/15513646.html
Copyright © 2020-2023  润新知