You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by "Bachran, Michael" <MB...@onebridge.de> on 2001/12/12 12:58:10 UTC

AsyncLogTarget: Can not write to closed target ...

Hi,

I got a problem with the asnychronous target. It always states it can not
write to a closed stream. It does not override the processEvent method in
AbstractTarget and therefore checks the isOpen flag! Does it need to? It can
be overridden in AsyncLogTarget not to check, but to check if the consuming
thread is running I patched it locally by setting the flag to true at the
beginning of the run method of the AsyncLogTarget:

AsyncLogTarget:

    public void run()
    {
        //set this variable when thread is interupted
        //so we know we can shutdown thread soon.
        boolean interupted = false;

+        open();

        while( true )


Maybe someone can patch it?
Is there a need to set it back if the thread dies?


Michael

Re: AsyncLogTarget: Can not write to closed target ...

Posted by Peter Donald <pe...@apache.org>.
On Wed, 12 Dec 2001 22:58, Bachran, Michael wrote:
> I got a problem with the asnychronous target. It always states it can not
> write to a closed stream. It does not override the processEvent method in
> AbstractTarget and therefore checks the isOpen flag! Does it need to? It
> can be overridden in AsyncLogTarget not to check, but to check if the
> consuming thread is running I patched it locally by setting the flag to
> true at the beginning of the run method of the AsyncLogTarget:

Wierd. Works fine on one of my projects but looking at the code it shouldn't 
work at all. Hmmm. Any I fixed this (actually moved open() into constructor) 
and I also wrapped the delegation of log event in a try-catch block to stop 
it ending the thread. 

Could you make sure these things work for you? I won't be able to test it 
till the weekend but it looks like it should work.

-- 
Cheers,

Pete

-------------------------------------------------
"Sometimes its better to keep your mouth shut and 
let people think your an idiot, than to open it 
and remove all doubt." 
-------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>