How to kill a running thread in java
You can ask the thread to interrupt, by calling Thread.interrupt()
Note that a few other methods with similar semantics exist - stop()
and destroy()
- but they are deprecated, because they are unsafe. Don't be tempted to use them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With