Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But you can't do that in Java. Did you use the Thread.stop() method they mentioned in the blog post (removed in Java 8)??


This is a minor inaccuracy in Julia's post, Thread.stop() is deprecated, but it has not been disabled or removed: https://docs.oracle.com/en%2Fjava%2Fjavase%2F17%2Fdocs%2Fapi...().

InterruptedException is better, but requires something closer to cooperative multi-tasking. If the thread is in a long-running loop that's not doing IO or it swallows the InterruptedException, you won't actually be able to kill the thread.

At work, someone had implemented an interface that let you kill a thread prior to my joining the company, so I found out that the warnings are very real when someone did that and it left the application unable to fetch DB connections.


ThreadGroup.stop() was removed in 23, so maybe in the future it'll actually be removed.


InterruptedException is better but still handled incorrectly/badly in user code all the time. Sort of like interrupting processes: one process dying won’t corrupt the state of another, but the other process can continue on with bad assumptions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: