Thread.stop() has been deprecated for quite some time, and I doubt it will go away any time soon unless there’s a good alternative.
However, IF you feel the need to use it, you should think very very carefully about it, and you should definitly feel bad about writing code that bad.
One example of why it’s bad is that it effectively causes the thread to throw an exception (Actually, an error; ThreadDeath) at a random point in your code.
For example, calling thread.stop() while the thread happens to be in the following method can REALLY mess up your program:
public synchronized switchBuffers()
{
ByteBuffer tmp = buffer0;
buffer0 = buffer1;
// If the thread happens to be stopped here, you’re screwed.
buffer1 = tmp;
}
Of course, there are ways to work around that, such as catching ThreadDeath(*) or synchronizing over some lock before calling thread.stop()(**), but in general you’re just potentially shooting yourself in the foot by adding exceptions that can be thrown at random.
(* Don’t.)
(** This is probably about as hard to implement properly as it would be to stop the thread the “correct” way)