3 ms·
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)??
by brabel 2y ago
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)??
- oefrha 2y agoInterruptedException 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.
- hyperpape 2y agoThis 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%2F%2F/java.base/java/lang/Thread.html#stop 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.
- philipwhiuk 2y agoThreadGroup.stop() was removed in 23, so maybe in the future it'll actually be removed.