How to stop a thread created by implementing runnable interface?

前端 未结 6 2190
独厮守ぢ
独厮守ぢ 2020-11-27 13:08

I have created class by implementing runnable interface and then created many threads(nearly 10) in some other class of my project.
How to stop some of those threads?

6条回答
  •  离开以前
    2020-11-27 13:41

    Stopping (Killing) a thread mid-way is not recommended. The API is actually deprecated.

    However,you can get more details including workarounds here: How do you kill a thread in Java?

提交回复
热议问题