avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: Decomissioning ActiveMonitor issue
Date Mon, 30 Sep 2002 12:46:53 GMT
Greg Steuck wrote:
> Hi Marcus,
>>>>>>"Marcus" == Marcus Crafter <crafterm@fztig938.bank.dresdner.net>
>     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?

If he calls dispose() *before* he calls InterruptedException, then it
would work.  The order is very important in this case.

>     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
> ------------------------------------------------------------------------
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message