cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Subject Re: AW: [c2] timeout parameter to FileGenerator
Date Thu, 17 May 2001 05:14:58 GMT
On Thu, 17 May 2001, giacomo wrote:

> > 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?
> Did you take into account that there are several FileGenerator in the
> system (several instances are pooled).

sure. my thought now is that i'll need to fire off two threads - one
thread to go off and try to do the parsing, and a timeout thread to sleep
for the length of the timeout. if the timeout thread wakes up and the
endDocument method hasn't been called yet, it will call endDocument
itself, tell the content handler to ignore future sax event method calls,
and kill the parser thread if it can. i suppose the main thread will have
to stick around until endDocument has been called one way or another to
prevent the FileGenerator instance from being reused by another pipeline
before the parsing is complete. how exactly does the FileGenerator
instance get flagged as ready-to-be-recycled?

sure seems like there should be an easier way than all this. would it make
more sense to put the url-resource-downloading stuff into a seperate
library with methods with configurable timeouts and such and pass
inputsources constructed on streams or byte arrays rather than urls to the

- donald

To unsubscribe, e-mail:
For additional commands, email:

View raw message