cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: question on trax serializers
Date Wed, 04 Apr 2001 17:33:07 GMT
Donald Ball wrote:
> 
> hey guys, i was playing around with adding caching to c2, just of the
> final output - i was going to profile it on my local box and see what sort
> of performance increase (or decrease) it resulted in. my sort of take on
> it was to modify ResourcePipeline and have it pass a ByteArrayOutputStream
> to the serializer instead of the environment's OutputStream. fair enough,
> but how do we know when the serializer is finished? i don't think it's
> sufficient to have called generator.generate(), because the various
> sitemap components might (almost certainly will) fire off threads to do
> their jobs. so i wrote me a little OutputStream wrapper class to notify me
> when OutputStream.close() is called:
> 
> package org.apache.cocoon.util;
> 
> import java.io.OutputStream;
> import java.io.FilterOutputStream;
> import java.io.IOException;
> 
> public class NotifyingOutputStream extends FilterOutputStream {
> 
>   protected Object recipient;
>   protected boolean isClosed = false;
> 
>   public NotifyingOutputStream (OutputStream output, Object recipient) {
>     super(output);
>     this.recipient = recipient;
>   }
> 
>   public void close() throws IOException {
>     super.close();
>     isClosed = true;
>     recipient.notify();
>   }
> 
>   public boolean isClosed() {
>     return isClosed;
>   }
> 
> }
> 
> and i wait() on the recipient Object in ResourcePipeline until the close()
> method is called and i'm notified. seems simple enough, but the close()
> method is never called. isn't it the job of the trax serializer to close
> the OutputStream when it's finished?

I think (practically) that we have the ServletEngine or CocoonServlet
close the output stream for us.

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


Mime
View raw message