You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/04/14 00:04:24 UTC

svn commit: r161222 - cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java cocoon/trunk/status.xml

Author: vgritsenko
Date: Wed Apr 13 15:04:23 2005
New Revision: 161222

URL: http://svn.apache.org/viewcvs?view=rev&rev=161222
Log:
getValidityForEventPipeline must return null validity for partially cached responses

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java?view=diff&r1=161221&r2=161222
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java Wed Apr 13 15:04:23 2005
@@ -366,11 +366,11 @@
 
                 this.toCacheSourceValidities =
                     new SourceValidity[this.toCacheKey.size()];
+
                 int len = this.toCacheSourceValidities.length;
                 int i = 0;
                 while (i < len) {
-                    final SourceValidity validity =
-                        this.getValidityForInternalPipeline(i);
+                    final SourceValidity validity = getValidityForInternalPipeline(i);
 
                     if (validity == null) {
                         if (i > 0
@@ -385,8 +385,7 @@
                                 this.cacheCompleteResponse = false;
                             }
                             SourceValidity[] copy = new SourceValidity[i];
-                            System.arraycopy(this.toCacheSourceValidities, 0,
-                                             copy, 0, copy.length);
+                            System.arraycopy(this.toCacheSourceValidities, 0, copy, 0, copy.length);
                             this.toCacheSourceValidities = copy;
                             len = this.toCacheSourceValidities.length;
                         } else {
@@ -784,10 +783,12 @@
 
 
     /**
-     * Return valid validity objects for the event pipeline
-     * If the "event pipeline" (= the complete pipeline without the
+     * Return valid validity objects for the event pipeline.
+     *
+     * If the event pipeline (the complete pipeline without the
      * serializer) is cacheable and valid, return all validity objects.
-     * Otherwise return <code>null</code>
+     *
+     * Otherwise, return <code>null</code>.
      */
     public SourceValidity getValidityForEventPipeline() {
         if (isInternalError()) {
@@ -795,6 +796,12 @@
         }
 
         if (this.cachedResponse != null) {
+            if (!this.cacheCompleteResponse &&
+                    this.firstNotCacheableTransformerIndex < super.transformers.size()) {
+                // Cache contains only partial pipeline.
+                return null;
+            }
+
             if (this.toCacheSourceValidities != null) {
                 // This means the pipeline is valid based on the validities
                 // of the individual components
@@ -802,32 +809,34 @@
                 for (int i=0; i < this.toCacheSourceValidities.length; i++) {
                     validity.add(this.toCacheSourceValidities[i]);
                 }
+
                 return validity;
             }
-            else {
-                // This means that the pipeline is valid because it has not yet expired
-                return NOPValidity.SHARED_INSTANCE;
-            }
+
+            // This means that the pipeline is valid because it has not yet expired
+            return NOPValidity.SHARED_INSTANCE;
         } else {
             int vals = 0;
 
-            if ( null != this.toCacheKey
-                 && !this.cacheCompleteResponse
-                 && this.firstNotCacheableTransformerIndex == super.transformers.size()) {
-                 vals = this.toCacheKey.size();
-            } else if ( null != this.fromCacheKey
-                         && !this.completeResponseIsCached
-                         && this.firstProcessedTransformerIndex == super.transformers.size()) {
-                 vals = this.fromCacheKey.size();
+            if (null != this.toCacheKey
+                    && !this.cacheCompleteResponse
+                    && this.firstNotCacheableTransformerIndex == super.transformers.size()) {
+                vals = this.toCacheKey.size();
+            } else if (null != this.fromCacheKey
+                    && !this.completeResponseIsCached
+                    && this.firstProcessedTransformerIndex == super.transformers.size()) {
+                vals = this.fromCacheKey.size();
             }
-            if ( vals > 0 ) {
+
+            if (vals > 0) {
                 final AggregatedValidity validity = new AggregatedValidity();
-                for(int i=0; i < vals; i++) {
-                    validity.add(this.getValidityForInternalPipeline(i));
-                    //validity.add(new DeferredPipelineValidity(this, i));
+                for (int i = 0; i < vals; i++) {
+                    validity.add(getValidityForInternalPipeline(i));
                 }
+
                 return validity;
             }
+
             return null;
         }
     }

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&r1=161221&r2=161222
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Wed Apr 13 15:04:23 2005
@@ -426,6 +426,10 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="VG" type="fix">
+      Fixed caching of a pipeline aggregating non cacheable pipelines via
+      <code>cocoon:</code> protocol.
+    </action>
     <action dev="VG" type="update">
       Stacktrace of the ResourceNotFound exception is logged only in DEBUG level,
       otherwise only exception message is logged.