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/language/generator GeneratorSelector.java
Date Thu, 16 Aug 2001 01:27:24 GMT
vgritsenko    01/08/15 18:27:24

  Modified:    src/org/apache/cocoon/components/language/generator Tag:
                        cocoon_20_branch GeneratorSelector.java
  Log:
  patching memory leaks. taked excalibur's approach to store component-handler mapping.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.1.1.2.7 +20 -3     xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java
  
  Index: GeneratorSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java,v
  retrieving revision 1.1.1.1.2.6
  retrieving revision 1.1.1.1.2.7
  diff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7
  --- GeneratorSelector.java	2001/07/13 19:00:24	1.1.1.1.2.6
  +++ GeneratorSelector.java	2001/08/16 01:27:23	1.1.1.1.2.7
  @@ -32,7 +32,7 @@
    * includes Sitemaps and XSP Pages
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.1.1.2.6 $ $Date: 2001/07/13 19:00:24 $
  + * @version CVS $Revision: 1.1.1.1.2.7 $ $Date: 2001/08/16 01:27:23 $
    */
   public class GeneratorSelector extends ExcaliburComponentSelector implements Disposable
{
   
  @@ -49,6 +49,9 @@
   
       protected Map componentHandlers = new HashMap();
   
  +    /** Dynamic component handlers mapping. */
  +    private Map componentMapping = new HashMap();
  +
       public void contextualize(Context context) {
           super.contextualize(context);
           this.context = context;
  @@ -83,12 +86,26 @@
               // if it isn't loaded, it may already be compiled...
               try {
                   ComponentHandler handler = (ComponentHandler) this.componentHandlers.get(hint);
  -
  -                return (Component) handler.get();
  +                Component component = (Component) handler.get();
  +                componentMapping.put(component, handler);
  +                return component;
               } catch (Exception ce) {
                   getLogger().debug("Could not access component for hint: " + hint);
                   throw new ComponentException("Could not access component for hint: " +
hint, null);
               }
  +        }
  +    }
  +
  +    public void release(Component component) {
  +        ComponentHandler handler = (ComponentHandler)componentMapping.get(component);
  +        if (handler != null) {
  +            try {
  +                handler.put(component);
  +            } catch (Exception e) {
  +                getLogger().error("Error trying to release component", e);
  +            }
  +        } 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