Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 5041 invoked from network); 30 Apr 2006 09:26:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Apr 2006 09:26:04 -0000 Received: (qmail 89023 invoked by uid 500); 30 Apr 2006 09:26:02 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 88955 invoked by uid 500); 30 Apr 2006 09:26:02 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 88944 invoked by uid 99); 30 Apr 2006 09:26:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Apr 2006 02:26:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of dev.sensei@gmail.com designates 64.233.182.187 as permitted sender) Received: from [64.233.182.187] (HELO nproxy.gmail.com) (64.233.182.187) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Apr 2006 02:26:00 -0700 Received: by nproxy.gmail.com with SMTP id n28so1434685nfc for ; Sun, 30 Apr 2006 02:25:39 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:message-id:mime-version:content-type:x-mailer:thread-index:x-mimeole; b=Yjf4jbYef9UZyLqv3Zoe8MckcnBz2B3ZHiYjy/Z9dmMNhLyGY5v+BesJEOjnibOpIDHBSRfTb7vIYzjtfnkKnRXpQwalizitzHXTE6naK3k6gTYF0tV5uhuCDsMh32m6GKeBAVlf+2PStCh6HcdX71HrqXcHb1VRsaKth59/Ixs= Received: by 10.49.42.6 with SMTP id u6mr3089091nfj; Sun, 30 Apr 2006 02:25:36 -0700 (PDT) Received: from blackdragon ( [84.179.37.195]) by mx.gmail.com with ESMTP id v20sm189725nfc.2006.04.30.02.25.33; Sun, 30 Apr 2006 02:25:36 -0700 (PDT) From: "Stefan Pietschmann" To: Subject: Desparately seeking help with pipeline implementation Date: Sun, 30 Apr 2006 11:25:36 +0200 Message-ID: <000001c66c38$0b55d260$16b2a8c0@blackdragon> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01C66C48.CEDEA260" X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcZsOAmQJoZu8IYoSjWYZrtm1YQ5OQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C66C48.CEDEA260 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi guys, for my thesis I have implemented a custom pipeline, which modifies the list of transformers to be run during pipeline setup. This is done with every request in setupPipeline(), so I need to reset to the original every time, before I modify again. That's why I try to do a backup of the list, then reload it at the beginning. It has been working smoothly so far, but I just started testing deeply with JMeter, and when I use 10 Threads (my testcase is that 10 Threads are 10 times requesting a page for 10 times, so 1000 requests altogether), I'm running into problems. I get errors around the 150th request. and they are getting more and more. They occur in several classes (the TraxTransformer, IntStack, SAX2DTM and so on), but I'm pretty sure that's not where the problem lies, because with the default pipeline there are no such problems. Can you please look into my implementation? I'm sure there must be some stupid mistake (I haven't worked in multithreading environments yet). This is really important since my deadline is very very near and this came totally surprising to me :-( I have simplified the pipeline as much as I could - you only need to adjust the package to where you put it and add it to your sitemap. When running a simple testcase with several threads, you will see the problems :-( package *** import java.util.ArrayList; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline; import org.apache.cocoon.environment.Environment; public class TestPipeline extends NonCachingProcessingPipeline { /** Backup List for Transformers. */ private ArrayList transformersB = null; /** * Setup pipeline components, additionally call adaptPipeline() */ protected void setupPipeline(Environment env) throws ProcessingException { this.adaptPipeline(env); super.setupPipeline(env); } /** * Changes the default transformer list for this request */ private void adaptPipeline(Environment env) { // ## create a backup of the "pipeline" if (!hasBackup()) this.backupTransformerLists(); else this.resetTransformerLists(); // then adapt .... } /** * Creates a backup of this.transformers (shallow copy - is a deep copy necessary? If yes, how?) */ private void backupTransformerLists() { // ## backup transformers list this.transformersB = (ArrayList) this.transformers.clone(); } /** * Loads the backed up transformer list. */ private void resetTransformerLists() { // ## reset lists to default from backup this.transformers = (ArrayList) this.transformersB.clone(); } /** * @return True, if a backup of the transformer lists exists, otherwise * false. */ private boolean hasBackup() { if (this.transformersB != null) return true; return false; } } ------=_NextPart_000_0001_01C66C48.CEDEA260 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi guys,

 

for my thesis I have implemented a custom = pipeline, which modifies the list of transformers to be run during pipeline setup. = This is done with every request in setupPipeline(), so I need to reset to the original every time, before I modify again. That's why I try to do a = backup of the list, then reload it at the beginning. It has been working smoothly so = far, but I just started testing deeply with JMeter, and when I use 10 Threads (my testcase is that 10 Threads are 10 times requesting a page for 10 times, = so 1000 requests altogether), I'm running into problems. I get errors = around the 150th request… and they are getting more and more. They = occur in several classes (the TraxTransformer, IntStack, SAX2DTM and so on), but = I'm pretty sure that's not where the problem lies, because with the default pipeline there are no such problems. Can you please look into my = implementation? I'm sure there must be some stupid mistake (I haven't worked in = multithreading environments yet).

This is really important since my deadline is = very very near and this came totally surprising to me L

 

I have simplified the pipeline as much as I = could – you only need to adjust the package to where you put it and add it to = your sitemap. When running a simple testcase with several threads, you will = see the problems L

 

 

package ***

 

import = java.util.ArrayList;

 

import = org.apache.cocoon.ProcessingException;

import org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline;<= o:p>

import = org.apache.cocoon.environment.Environment;

 

public class TestPipeline extends NonCachingProcessingPipeline {

 

    /** Backup List for = Transformers. */

    private ArrayList = transformersB =3D null;

 

    = /**

     * Setup pipeline = components, additionally call = <code>adaptPipeline()</code>

     = */

    protected void setupPipeline(Environment env) throws ProcessingException = {

        = this.adaptPipeline(env);

        super.setupPipeline(env);

    }

 

    = /**

    * Changes the default = transformer list for this request

    = */

    private void adaptPipeline(Environment env) {

        = // ## create a backup of the = "pipeline"

        if = (!hasBackup())

        = ;    this.backupTransformerLists();

        = else

        = ;    this.resetTransformerLists();

        // = then adapt ....

    = }

 

    = /**

     * Creates a backup of this.transformers (shallow copy – is a deep copy necessary? If = yes, how?)

     = */

    private void backupTransformerLists() {

        // = ## backup transformers list

        this.transformersB =3D (ArrayList) = this.transformers.clone();

    = }

 

    = /**

     * Loads the backed up transformer list.

     = */

    private void = resetTransformerLists() {

        // = ## reset lists to default from backup

        this.transformers =3D (ArrayList) = this.transformersB.clone();

    = }

 

    = /**

     * @return <code>True</code>, if a backup of the transformer lists = exists, otherwise

     *         = <code>false</code>.

     = */

    private boolean hasBackup() = {

        if (this.transformersB !=3D null) return true;

        = return false;

    = }

}

------=_NextPart_000_0001_01C66C48.CEDEA260--