java thread reuse

后端 未结 4 1967
不知归路
不知归路 2020-12-02 10:21

I have always read that creating threads is expensive.
I also know that you cannot rerun a thread.

I see in the doc of Executors class:

4条回答
  •  醉酒成梦
    2020-12-02 10:56

    The thread pool consists of a number of fixed worker threads that can take tasks from an internal task queue. So if one task ends, the thread does not end but waits for the next task. If you abort a thread, it is automatically replaced.

    Look at the documentation for more details.

提交回复
热议问题