Java multi-threading - stop the thread

1, Java terminated 3 method running threads:

  1) run () method is completed after the normal termination

  2) are Thread.stop () forcibly terminated

  3) Use Thread.interrupt () interrupt thread

 

2、Thread.stop()

  This method can be made to stop a thread, but it is not the best, because this method is unsafe and has been abandoned (annotated as @Deprecated)

 

3、Thread.interrupt()

  Direct calls will not stop running threads, you need to join a judge before they can complete thread stop.

Guess you like

Origin www.cnblogs.com/lkc9/p/12441214.html