Stopping a Thread in Java?

后端 未结 6 2016
耶瑟儿~
耶瑟儿~ 2020-11-30 06:46

I\'m in the process of writing a piece of code that connects to a server spawns a bunch of threads using that connection and does a bunch of \"stuff\".

There are cer

6条回答
  •  萌比男神i
    2020-11-30 07:44

    Use your_thread.interrupt and check in your thread if Thread.interrupted() return true. If so, close your thread properly.

提交回复
热议问题