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/sitemap SitemapComponentSelector.java
Date Thu, 16 Aug 2001 01:36:28 GMT
vgritsenko    01/08/15 18:36:28

  Modified:    src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        SitemapComponentSelector.java
  Log:
  patching memory leaks. taken excalibur's approach to store component-handler mapping.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.8   +12 -9     xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java
  
  Index: SitemapComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java,v
  retrieving revision 1.2.2.7
  retrieving revision 1.2.2.8
  diff -u -r1.2.2.7 -r1.2.2.8
  --- SitemapComponentSelector.java	2001/07/29 11:08:18	1.2.2.7
  +++ SitemapComponentSelector.java	2001/08/16 01:36:27	1.2.2.8
  @@ -23,17 +23,21 @@
   /** Default component manager for Cocoon's sitemap components.
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: SitemapComponentSelector.java,v 1.2.2.7 2001/07/29 11:08:18 cziegeler
Exp $
  + * @version CVS $Id: SitemapComponentSelector.java,v 1.2.2.8 2001/08/16 01:36:27 vgritsenko
Exp $
    */
   public class SitemapComponentSelector extends ExcaliburComponentSelector {
       private Map mime_types;
       private SitemapComponentSelector parentSelector;
   
  +    /** Dynamic component handlers mapping. */
  +    private Map componentMapping;
  +
       /** The conctructors (same as the Avalon ComponentManager)
        */
       public SitemapComponentSelector() {
           super();
           this.mime_types = new HashMap();
  +        componentMapping = Collections.synchronizedMap(new HashMap());
       }
   
       public void setParentSelector(SitemapComponentSelector newSelector) {
  @@ -50,6 +54,7 @@
           } catch (ComponentException ce) {
               if (this.parentSelector != null) {
                   component = this.parentSelector.select(hint);
  +                componentMapping.put(component, this.parentSelector);
               } else {
                   throw ce;
               }
  @@ -59,14 +64,12 @@
       }
   
       public void release(Component component) {
  -        // FIXME (CZ)
  -        // Is this alright, to release the component using both
  -        // selectors?
  -        // But at this stage we don't know which selector
  -        // was used to select the component!
  -        super.release(component);
  -        if (this.parentSelector != null) {
  -            this.parentSelector.release(component);
  +        SitemapComponentSelector selector = (SitemapComponentSelector)componentMapping.get(component);
  +        if(selector != null) {
  +            componentMapping.remove(component);
  +            selector.release(component);
  +        } else {
  +            super.release(component);
           }
       }
   
  
  
  

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