> It's a good book by the way. If the Thread.interrupt method gives an > Computer Science professor and an expert in the field such hard time, I > don't think we should attempt to be "smart". Thread.interrupt is not > needed. Nice and simple. End of story. > > Just remove the "watchdogThread.interrupt();" statement and your code > will continue to run just as well.
Hm. I don't think I have a race condition here. I am just trying to wake up a sleeping thread so the watchdog can shutdown faster. If you have set the interval to 60 seconds, it could be up to a minute before the watchdog wakes up and figures out it should shutdown. How can/should I do this differently? Also, you'll notice that I do not use interrupt() for the SocketWatchdog. Experience has shown that the interrupt() call does NOT cause the ServerSocket.accept() to interrupt itself (contrary to the first link you sent). At least not in JDK 1.3. That is why I set the SoTimeout property to 2 seconds. So, it could take up to 2 seconds for a SocketWatchdog to shutdown completely. That could be a problem if as part of watchdogs being allowed in configuration files, the new watchdog being configured wants to use the same port number. It could be up to 2 seconds before the port is free from the original watchdog. Maybe watchdogs should not return from the stopWatchdog() method until the watchdog is completely shutdown. thanks, -Mark -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>