cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl AbstractCachingProcessingPipeline.java SourceDeferredValidity.java
Date Mon, 13 Jan 2003 14:44:34 GMT
cziegeler    2003/01/13 06:44:34

  Modified:    src/java/org/apache/cocoon/components/pipeline/impl
                        AbstractCachingProcessingPipeline.java
  Removed:     src/java/org/apache/cocoon/components/pipeline/impl
                        SourceDeferredValidity.java
  Log:
  Next step for caching
  
  Revision  Changes    Path
  1.18      +33 -2     xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
  
  Index: AbstractCachingProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AbstractCachingProcessingPipeline.java	13 Jan 2003 14:38:16 -0000	1.17
  +++ AbstractCachingProcessingPipeline.java	13 Jan 2003 14:44:34 -0000	1.18
  @@ -64,6 +64,7 @@
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.excalibur.source.SourceValidity;
   import org.apache.excalibur.source.impl.validity.DeferredAggregatedValidity;
  +import org.apache.excalibur.source.impl.validity.DeferredValidity;
   
   import java.io.ByteArrayOutputStream;
   import java.io.OutputStream;
  @@ -133,6 +134,9 @@
       /** Default setting for smart caching */
       protected boolean configuredDoSmartCaching;
       
  +    /** Deferred source validities (for performance) */
  +    protected DeferredPipelineValidity[] deferredValidities = new DeferredPipelineValidity[8];
  +    
       /**
        * Abstract methods defined in subclasses
        */
  @@ -155,6 +159,10 @@
       public void parameterize(Parameters params) {
           super.parameterize(params);
           this.configuredDoSmartCaching = params.getParameterAsBoolean("smart-caching", true);
  +        // initialize array of deferred pipeline validities
  +        for(int i=0; i<this.deferredValidities.length;i++) {
  +            this.deferredValidities[i] = new DeferredPipelineValidity(this, i);
  +        }
       }
       
       /**
  @@ -774,8 +782,13 @@
           if (!this.completeResponseIsCached
                   && this.firstNotCacheableTransformerIndex == super.transformers.size())
{
               DeferredAggregatedValidity validity = new DeferredAggregatedValidity();
  +            final int maxObjectCache = this.deferredValidities.length;
               for(int i=0; i < this.toCacheKey.size(); i++) {
  -                validity.add(new SourceDeferredValidity(this, i));
  +                if (i < maxObjectCache) {
  +                    validity.add(this.deferredValidities[i]);
  +                } else {
  +                    validity.add(new DeferredPipelineValidity(this, i));
  +                }
               }
               return validity;
           }
  @@ -848,5 +861,23 @@
           }
           this.cache = null;
           this.manager = null;
  +    }
  +}
  +
  +final class DeferredPipelineValidity implements DeferredValidity {
  +
  +    private final AbstractCachingProcessingPipeline pipeline;
  +    private final int index;
  +    
  +    public DeferredPipelineValidity(AbstractCachingProcessingPipeline pipeline, int index)
{
  +        this.pipeline = pipeline;
  +        this.index = index;
  +    }
  +    
  +    /**
  +     * @see org.apache.excalibur.source.impl.validity.DeferredValidity#getValidity()
  +     */
  +    public SourceValidity getValidity() {
  +        return pipeline.getValidityForInternalPipeline(this.index);
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message