Have a method, such as stop(), that sets a boolean, and in the thread that's
running, have it loop testing if the boolean has been set by stop() or not,
and if so, then exit itself.

Stopping a thread otherwise is problematic because it is not clear where it
was when it was stopped (it's an ugly stop).  I've heard it mentioned that
it can also leave some threads in a bad a state, but that seems more like a
bug with the JVM not doing clean-up to me.   But stopping nicely is always
best...

David

Reply via email to