cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vgritse...@hns.com>
Subject RE: AW: [c2] timeout parameter to FileGenerator
Date Wed, 16 May 2001 20:57:16 GMT
Donald,

If you are using sockets, the most simple and effective solution would be
socket.setSoTimeout() to timeout value.

In this case, you do not need any extra threads and complicated synchronization
mechanism.

Is it possible to do this way?


Vadim

> -----Original Message-----
> From: Donald Ball [mailto:balld@webslingerZ.com]
> Sent: Wednesday, May 16, 2001 13:58
> To: cocoon-dev@xml.apache.org
> Subject: Re: AW: [c2] timeout parameter to FileGenerator
> 
> 
> On Wed, 16 May 2001, Carsten Ziegeler wrote:
> 
> > > generate method, the parser will fire off another connection:
> > >
> > >             parser.parse(this.inputSource);
> > >
> > > hmm. that's not so good. is this an accurate assessment?
> > >
> > Yes, absolutely, it's totally bad. It was a first quick shot at
> > implementing caching for the file generator. This really should
> > be changed.
> > As far as I know this code is used in several components.
> 
> hee. hmm. well i took a first pass at adding support for a timeout
> parameter to c2, but i don't think my approach was good. i added a
> WorkerThread inner class to the FileGenerator and put the parsing stuff in
> it. the main thread waits on a shared lock object until notified or until
> the timeout has expired. it works okay, but there are two problems:
> 
> 1. you can't stop java threads any longer (!) and the interrupt signal is
> only recognized if the receiving thread is sleeping or waiting.
> 
> 2. there is no guarantee that the parser doesn't fire off subthreads of
> its own to do its work. just because parser.parse() returns doesn't mean
> that parsing is complete.
> 
> my next thought is to create a TimeoutContentHandler inner class that
> wraps the normal ContentHandler and reports a timeout error to its parent
> if the endDocument() method hasn't been called by the timeout. any
> comments?
> 
> - donald
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message