> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Kees Jongenburger
>
>  code should never call Thread.stop() if you really need to 
> stop a thread .. this is code that might work
>         kicker.interrupt();
>         kicker = null;

Agreed. 

Caution is in order, however, because interrupt() does not generally
terminate a thread. It just sets it "interrupted" flag, or causes it to
throw an exception (e.g. InterruptedException) when it was sleeping,
waiting, blocking on I/O, etc.

To ensure that a thread terminates after it's interrupt() method is
called, you need to both catch these exceptions and periodically check
its "interrupted" flag to detect interrupts, and make it react by
exiting its run() method.

For details, see javadoc on java.lang.Thread methods interrupt(),
interrupted() and isInterrupted().

Rob van Maris
Technical Consultant

Quantiq
xmedia & communication solutions

Koninginneweg 11-13
1217 KP Hilversum
 
T    +31 (0)356257211
M    +31 (0)651444006
E    [EMAIL PROTECTED]


Reply via email to