cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <dev.sen...@gmail.com>
Subject Desparately seeking help with pipeline implementation
Date Sun, 30 Apr 2006 09:25:36 GMT
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
<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 = (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 <code>True</code>, if a backup of the transformer lists
exists, otherwise

     *         <code>false</code>.

     */

    private boolean hasBackup() {

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

        return false;

    }

} 


Mime
View raw message