Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 66245 invoked by uid 500); 4 Apr 2001 17:35:31 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 66207 invoked from network); 4 Apr 2001 17:35:29 -0000 Message-ID: <3ACB5AD3.73876479@apache.org> Date: Wed, 04 Apr 2001 13:33:07 -0400 From: Berin Loritsch X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: Re: question on trax serializers References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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