Looks good to me - Applied! On Sat, 28 Sep 2002 03:19, Greg Steuck wrote: > Hi Marcus, > > >>>>> "Marcus" == Marcus Crafter <[EMAIL PROTECTED]> > >>>>> writes: > > Marcus> This causes problems in our environment because our > Marcus> monitor interval is set to 30 mins, which means > Marcus> ActiveMonitor.stop() could take up to 30 mins to complete > Marcus> due to the current thread waiting for the monitor thread > Marcus> to complete. > > Marcus> I changed the code to do an interrupt() instead of a > Marcus> join(), ie. to interrupt the monitor thread out of it's > Marcus> sleep(), and everything worked fine. The actual diff is > Marcus> below. > > But it shouldn't work fine. InterruptedException is simply ignored by > delay() in the monitor thread and it resumes waiting. Could you double > check that your fix actually works? If it does, could you explain how? > > Marcus> Just wondering if there are any issues or problems > Marcus> with this change that I'm not aware of ? If so, any ideas > Marcus> how to fix the original problem ? > > Could somebody explain why InterruptedException is suppressed in > delay() and sleep is resumed by run()? It seems to be wrong: it's > not like somebody is running around sending InterruptedException > exceptions to thread and you need to ignore them. The only thing > that can send such exception to the monitor thread is the > ActiveMonitor that created it in the first place. And that exception > shouldn't be ignored. > > So, the patch I'm attaching: > > 1) interrupts the thread > 2) waits for it to terminate (Hi Chad!) > 3) terminates the monitor thread on InterruptedException > 4) declares m_keepRunning volatile since it is accessed concurrently, > even though it is a 4 byte entity and assignment is supposed > to be atomic > > The right way to handle this m_keepRunning thing would be to use a > Latch (e.g. from Doug Lea's util.concurrent). Any plans to integrate > or just use util.concurrent? > > Thanks > Greg
-- Cheers, Peter Donald --------------------------------------------------------- Clarke's Third Law: "Any technology distinguishable from magic is insufficiently advanced". --------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>