2 ms·
> java.lang.Thread.stop, which does essentially the same thing. It was deprecated in Java 1.2, in 1998, > Java has a Thread.interrupt method, which sends Inter
by scotty79 11y ago
> java.lang.Thread.stop, which does essentially the same thing. It was deprecated in Java 1.2, in 1998,
> Java has a Thread.interrupt method, which sends InterruptedException to a thread. But an InterruptedException is only allowed to be thrown at specific times, for instance during Thread.sleep. Otherwise the thread needs to explicitly call Thread.interrupted() to see if it’s supposed to stop.
I remember when I read about it back then when I played a bit with Java.
I felt bit baffled that they would make something so stupid like `stop()` ... after all Delphi that I learned some years before already had this solution that you only can notify the thread it should stop, through Termintated flag on the thread object and you had to write the thread code to voluntarily end when the flag is set.