Sam Samson wrote:Hi
How can I stop a Thread from running? I've read in the JavaGuide, that I could set the Thread reference to null.
What's happening if I do that? Will the running thread immediately stop, no matter where he actually is in the run() method?
Sam Samson wrote:And what's the difference between setting the Thread reference to null and using the interrupt() method?
Henry Wong wrote:
If you set your Thread reference to null, then that reference can no longer be used to access the thread object. The action will have absolutely no effect on the running thread.
Sam Samson wrote:what should I do If I don't have a loop in my run()?
Sam Samson wrote:And starting a second thread that is checking if the marker-variable is null or not and notifies the other thread is a bad idea or doesn't work at all?
Martin Vajsar wrote: If it was more than a second, the call was logged (logging a stack trace might be very useful in this context), and I was able to infer from the log which part of code needed to call the check routine more often.