Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 49970 invoked by uid 500); 23 May 2003 14:32:44 -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 49933 invoked from network); 23 May 2003 14:32:43 -0000 Received: from mail.s-und-n.de (212.8.217.2) by daedalus.apache.org with SMTP; 23 May 2003 14:32:43 -0000 Received: from mail.s-und-n.de (localhost [127.0.0.1]) by mail2.s-und-n.de (postfix) with ESMTP id 4FE71B75B4 for ; Fri, 23 May 2003 16:32:45 +0200 (CEST) Received: from notes.sundn.de (ntsrv5.sundn.de [10.10.2.10]) by mail.s-und-n.de (postfix) with ESMTP id 22D44B754A for ; Fri, 23 May 2003 16:32:45 +0200 (CEST) Received: from hw0386 ([10.10.2.34]) by notes.sundn.de (Lotus Domino Release 5.0.8) with SMTP id 2003052316324476:351031 ; Fri, 23 May 2003 16:32:44 +0200 From: "Carsten Ziegeler" To: Subject: RE: ContentAggregator and multithreating (migrating C2 -> C2.1M2), is it thread-safe? Date: Fri, 23 May 2003 16:34:08 +0200 Message-ID: MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-MIMETrack: Itemize by SMTP Server on PBSN1/Systeme und Netzwerke(Release 5.0.8 |June 18, 2001) at 23.05.2003 16:32:44, Serialize by Router on PBSN1/Systeme und Netzwerke(Release 5.0.8 |June 18, 2001) at 23.05.2003 16:32:44, Serialize complete at 23.05.2003 16:32:44 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Christoph Gaffga wrote: > Just to see if I got it right, you wrote: > > Have a look at the DefaultIncludeCacheManager - it can include in > parallel. > > my Aggregator does: > > // Part extends Thread > Part.run() { > SourceUtil.toSAX(part.source, buffer); > } > > // Aggregator.generate() > for(iterate all parts) { > part.start(); > } > for(iterate all parts) { > part.join(); > part.buffer.toSAX(contentHandler); > } > > so I need to do something like: > > // Aggregator.generate() > for(iterate all parts) { > part.includeCacheManager = new DefaultIncludeCacheManager(); > part.includeCacheManager.compose(this.manager); > part.session = includeCacheManager.getSession(this.par); > part.includeCacheManager.load(part.uri, part.session); > } > for(iterate all parts) { > part.includeCacheManager.stream(part.uri, part.session, > contentHandler); > } > > Is this right? Please give me a hint because I am not so familar > whith these > IncludeCacheManager(and Session)-stuff. Basically, yes. You have to turn on the parallel processing setting a parameter (it's documented) when calling getSession(Parameter). > P.S.: > is there a special reason you are using > // wait > while (!loader.finished) { > try { > Thread.sleep(10); > } catch (InterruptedException e) { } > } > in DefaultIncludeCacheManger (line 259). Isn't it better to have > the thread > as a class variable (see line 212) and then use thread.join()? > Hmmm, actually I don't know why this has been done in that way. Perhaps join() is better. Carsten