cziegeler    01/05/03 04:33:10

  Modified:    src/org/apache/cocoon/caching Tag: xml-cocoon2
                        CachedEventObject.java CachedStreamObject.java
               src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
                        CachingEventPipeline.java
                        CachingStreamPipeline.java
  Log:
  Caching components are now more verbose to find possible caching bugs
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +9 -1      
xml-cocoon/src/org/apache/cocoon/caching/Attic/CachedEventObject.java
  
  Index: CachedEventObject.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/caching/Attic/CachedEventObject.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CachedEventObject.java    2001/04/17 10:32:48     1.1.2.1
  +++ CachedEventObject.java    2001/05/03 11:33:05     1.1.2.2
  @@ -13,7 +13,7 @@
    * This is an cached object as it is stored in the <code>EventCache</code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/04/17 10:32:48 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/05/03 11:33:05 $
    */
   public final class CachedEventObject {
   
  @@ -43,6 +43,14 @@
               return true;
           }
           return false;
  +    }
  +
  +    /**
  +     * Get the validity object
  +     * @return The <CODE>CacheValidity</CODE> object or <CODE>null</CODE>.
  +     */
  +    public CacheValidity getCacheValidity(ComponentCacheKey componentKey) {
  +        return (CacheValidity)this.validityObjects.get(componentKey);
       }
   
       /**
  
  
  
  1.1.2.2   +9 -1      
xml-cocoon/src/org/apache/cocoon/caching/Attic/CachedStreamObject.java
  
  Index: CachedStreamObject.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/caching/Attic/CachedStreamObject.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CachedStreamObject.java   2001/04/17 10:32:50     1.1.2.1
  +++ CachedStreamObject.java   2001/05/03 11:33:06     1.1.2.2
  @@ -13,7 +13,7 @@
    * This is an cached object as it is stored in the <code>StreamCache</code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/04/17 10:32:50 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/05/03 11:33:06 $
    */
   public final class CachedStreamObject {
   
  @@ -43,6 +43,14 @@
               return true;
           }
           return false;
  +    }
  +
  +    /**
  +     * Get the validity object
  +     * @return The <CODE>CacheValidity</CODE> object or <CODE>null</CODE>.
  +     */
  +    public CacheValidity getCacheValidity(ComponentCacheKey componentKey) {
  +        return (CacheValidity)this.validityObjects.get(componentKey);
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13  +11 -5     
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingEventPipeline.java
  
  Index: CachingEventPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingEventPipeline.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- CachingEventPipeline.java 2001/04/30 14:17:12     1.1.2.12
  +++ CachingEventPipeline.java 2001/05/03 11:33:07     1.1.2.13
  @@ -52,7 +52,7 @@
    * does not cache! (If it would cache, the response would be cached twice!)
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/04/30 14:17:12 $
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/05/03 11:33:07 $
    */
   public final class CachingEventPipeline
   extends AbstractEventPipeline
  @@ -144,17 +144,23 @@
                   CachedEventObject cachedObject = 
(CachedEventObject)this.eventCache.get(this.pipelineCacheKey);
   
                   if (cachedObject != null) {
  -                    getLogger().debug("Found cached content.");
  +                    getLogger().debug("Found cached content for '" + 
environment.getURI() + "'.");
                       Iterator validityIterator = 
validityObjects.keySet().iterator();
                       ComponentCacheKey validityKey;
                       boolean valid = true;
                       while (validityIterator.hasNext() == true && valid == 
true) {
                           validityKey = 
(ComponentCacheKey)validityIterator.next();
                           valid = cachedObject.isValid(validityKey, 
(CacheValidity)validityObjects.get(validityKey));
  +                        if (getLogger().isDebugEnabled() == true) {
  +                            CacheValidity cachedValidity = 
cachedObject.getCacheValidity(validityKey);
  +                            getLogger().debug("Compared cached validity '" + 
cachedValidity +
  +                                "' with new validity '" + 
validityObjects.get(validityKey) +
  +                                "' : " + (valid == true ? "valid" : 
"changed"));
  +                        }
                       }
                       if (valid == true) {
   
  -                        getLogger().debug("Using valid cached content.");
  +                        getLogger().debug("Using valid cached content for '" 
+ environment.getURI() + "'.");
                           // get all transformers which are not cacheable
                           int transformerSize = this.transformers.size();
                           while (this.firstNotCacheableTransformerIndex < 
transformerSize) {
  @@ -182,14 +188,14 @@
                                   
this.manager.release((Component)deserializer);
                           }
                       } else {
  -                        getLogger().debug("Cached content is invalid.");
  +                        getLogger().debug("Cached content is invalid for '" 
+ environment.getURI() + "'.");
                           // remove invalid cached object
                           this.eventCache.remove(this.pipelineCacheKey);
                           cachedObject = null;
                       }
                   }
                   if (cachedObject == null) {
  -                    getLogger().debug("Caching content for further 
requests.");
  +                    getLogger().debug("Caching content for further requests 
of '" + environment.getURI() + "'.");
                       xmlSerializer = 
(XMLSerializer)this.manager.lookup(Roles.XML_SERIALIZER);
                   }
               }
  
  
  
  1.1.2.9   +21 -9     
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java
  
  Index: CachingStreamPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingStreamPipeline.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- CachingStreamPipeline.java        2001/04/30 14:17:12     1.1.2.8
  +++ CachingStreamPipeline.java        2001/05/03 11:33:08     1.1.2.9
  @@ -44,7 +44,7 @@
    *  </ul>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/04/30 14:17:12 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/05/03 11:33:08 $
    */
   public final class CachingStreamPipeline extends AbstractStreamPipeline {
   
  @@ -158,7 +158,7 @@
                   CachedStreamObject cachedObject = 
(CachedStreamObject)this.streamCache.get(pcKey);
   
                   if (cachedObject != null) {
  -                    getLogger().debug("Found cached response.");
  +                    getLogger().debug("Found cached response for '" + 
environment.getURI() + "'.");
   
                       Iterator validityIterator = 
validityObjects.keySet().iterator();
                       ComponentCacheKey validityKey;
  @@ -166,9 +166,15 @@
                       while (validityIterator.hasNext() == true && valid == 
true) {
                           validityKey = 
(ComponentCacheKey)validityIterator.next();
                           valid = cachedObject.isValid(validityKey, 
(CacheValidity)validityObjects.get(validityKey));
  +                        if (getLogger().isDebugEnabled() == true) {
  +                            CacheValidity cachedValidity = 
cachedObject.getCacheValidity(validityKey);
  +                            getLogger().debug("Compared cached validity '" + 
cachedValidity +
  +                                "' with new validity '" + 
validityObjects.get(validityKey) +
  +                                "' : " + (valid == true ? "valid" : 
"changed"));
  +                        }
                       }
                       if (valid == true) {
  -                        getLogger().debug("Using valid cached content.");
  +                        getLogger().debug("Using valid cached content for '" 
+ environment.getURI() + "'.");
   
                           usedCache = true;
                           byte[] response = cachedObject.getResponse();
  @@ -177,7 +183,7 @@
                               environment.setContentLength(response.length);
                           }
                       } else {
  -                        getLogger().debug("Cached content is invalid.");
  +                        getLogger().debug("Cached content is invalid for '" 
+ environment.getURI() + "'.");
   
                           // remove invalid cached object
                           this.streamCache.remove(pcKey);
  @@ -185,7 +191,7 @@
                       }
                   }
                   if (cachedObject == null) {
  -                    getLogger().debug("Caching content for further 
requests.");
  +                    getLogger().debug("Caching content for further requests 
of '" + environment.getURI() + "'.");
                       outputStream = new CachingOutputStream(outputStream);
                   }
               }
  @@ -269,7 +275,7 @@
                       CachedStreamObject cachedObject = 
(CachedStreamObject)this.streamCache.get(pcKey);
   
                       if (cachedObject != null) {
  -                        getLogger().debug("Found cached response.");
  +                        getLogger().debug("Found cached response for '" + 
environment.getURI() + "'.");
   
                           Iterator validityIterator = 
validityObjects.keySet().iterator();
                           ComponentCacheKey validityKey;
  @@ -277,15 +283,21 @@
                           while (validityIterator.hasNext() == true && valid 
== true) {
                               validityKey = 
(ComponentCacheKey)validityIterator.next();
                               valid = cachedObject.isValid(validityKey, 
(CacheValidity)validityObjects.get(validityKey));
  +                            if (getLogger().isDebugEnabled() == true) {
  +                                CacheValidity cachedValidity = 
cachedObject.getCacheValidity(validityKey);
  +                                getLogger().debug("Compared cached validity 
'" + cachedValidity +
  +                                    "' with new validity '" + 
validityObjects.get(validityKey) +
  +                                    "' : " + (valid == true ? "valid" : 
"changed"));
  +                            }
                           }
                           if (valid == true) {
   
  -                            getLogger().debug("Using valid cached content.");
  +                            getLogger().debug("Using valid cached content 
for '" + environment.getURI() + "'.");
                               usedCache = true;
                               outputStream.write(cachedObject.getResponse());
                           } else {
   
  -                            getLogger().debug("Cached content is invalid.");
  +                            getLogger().debug("Cached content is invalid for 
'" + environment.getURI() + "'.");
   
                               // remove invalid cached object
                               this.streamCache.remove(pcKey);
  @@ -293,7 +305,7 @@
                           }
                       }
                       if (cachedObject == null) {
  -                        getLogger().debug("Caching content for further 
requests.");
  +                        getLogger().debug("Caching content for further 
requests of '" + environment.getURI() + "'.");
                           outputStream = new CachingOutputStream(outputStream);
                       }
                   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to