cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/components/pipeline AbstractEventPipeline.java CachingEventPipeline.java
Date Fri, 22 Jun 2001 02:33:19 GMT
vgritsenko    01/06/21 19:33:19

  Modified:    src/org/apache/cocoon/components/pipeline Tag:
                        cocoon_20_branch AbstractEventPipeline.java
                        CachingEventPipeline.java
  Log:
  code cleanup, make sure that everything is recycle()d
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.5   +17 -18    xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
  
  Index: AbstractEventPipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java,v
  retrieving revision 1.5.2.4
  retrieving revision 1.5.2.5
  diff -u -r1.5.2.4 -r1.5.2.5
  --- AbstractEventPipeline.java	2001/06/21 06:54:20	1.5.2.4
  +++ AbstractEventPipeline.java	2001/06/22 02:33:17	1.5.2.5
  @@ -34,7 +34,7 @@
   /**
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:cziegeler@Carsten Ziegeler">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.5.2.4 $ $Date: 2001/06/21 06:54:20 $
  + * @version CVS $Revision: 1.5.2.5 $ $Date: 2001/06/22 02:33:17 $
    */
   public abstract class AbstractEventPipeline
   extends AbstractXMLProducer
  @@ -60,7 +60,7 @@
       throws ComponentException {
           this.manager = manager;
           generatorSelector = (ComponentSelector) this.manager.lookup(Roles.GENERATORS);
  -        transformerSelector = (ComponentSelector)this.manager.lookup(Roles.TRANSFORMERS);
  +        transformerSelector = (ComponentSelector) this.manager.lookup(Roles.TRANSFORMERS);
           Component saxConnector = null;
           this.configuredSAXConnector = false;
           try {
  @@ -241,10 +241,14 @@
       }
   
       public void dispose() {
  -        if(generatorSelector != null)
  +        if(generatorSelector != null){
               manager.release(generatorSelector);
  -        if(transformerSelector != null)
  +            generatorSelector = null;
  +        }
  +        if(transformerSelector != null){
               manager.release(transformerSelector);
  +            transformerSelector = null;
  +        }
       }
   
       public void recycle() {
  @@ -252,39 +256,34 @@
   
           try {
               // Release generator.
  -            if ( this.generatorSelector != null ) {
  -                if ( this.generator != null ) {
  -                    generatorSelector.release(this.generator);
  -                }
  +            if ( generatorSelector != null && this.generator != null ) {
  +                generatorSelector.release(this.generator);
               }
  -            this.generator = null;
   
               // Release transformers
  -            if(transformerSelector != null) {
  +            if ( transformerSelector != null ) {
                   Iterator itt = this.transformers.iterator();
                   while ( itt.hasNext() ) {
                       transformerSelector.release((Component)itt.next());
                   }
               }
   
  -            this.transformers.clear();
  -            this.transformerParams.clear();
  -            this.transformerSources.clear();
  -
               // Release connectors
               Iterator itc = this.connectors.iterator();
               while ( itc.hasNext() ) {
                   this.manager.release((Component) itc.next());
               }
  -            this.connectors.clear();
           } catch ( Exception e ) {
               getLogger().warn(
                   "Failed to release components from event pipeline.",
                   e
               );
  -        } finally {
  -            this.generator = null;
  -            this.transformers.clear();
           }
  +
  +        this.generator = null;
  +        this.transformers.clear();
  +        this.transformerParams.clear();
  +        this.transformerSources.clear();
  +        this.connectors.clear();
       }
   }
  
  
  
  1.7.2.6   +7 -11     xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java
  
  Index: CachingEventPipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java,v
  retrieving revision 1.7.2.5
  retrieving revision 1.7.2.6
  diff -u -r1.7.2.5 -r1.7.2.6
  --- CachingEventPipeline.java	2001/06/21 06:54:21	1.7.2.5
  +++ CachingEventPipeline.java	2001/06/22 02:33:18	1.7.2.6
  @@ -52,7 +52,7 @@
    * does not cache! (If it would cache, the response would be cached twice!)
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.7.2.5 $ $Date: 2001/06/21 06:54:21 $
  + * @version CVS $Revision: 1.7.2.6 $ $Date: 2001/06/22 02:33:18 $
    */
   public final class CachingEventPipeline
   extends AbstractEventPipeline
  @@ -216,16 +216,12 @@
                                        this.transformers,
                                        xmlSerializer);
                   // execute the pipeline:
  -                try {
  -                    this.generator.generate();
  -                    // did we have cacheable components?
  -                    if (xmlSerializer != null) {
  -                        this.eventCache.store(this.pipelineCacheKey,
  -                            new CachedEventObject(this.validityObjects,
  -                            xmlSerializer.getSAXFragment()));
  -                    }
  -                } catch ( Exception e ) {
  -                    throw e;
  +                this.generator.generate();
  +                // did we have cacheable components?
  +                if (xmlSerializer != null) {
  +                    this.eventCache.store(this.pipelineCacheKey,
  +                        new CachedEventObject(this.validityObjects,
  +                        xmlSerializer.getSAXFragment()));
                   }
               }
           } finally {
  
  
  

----------------------------------------------------------------------
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