avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory DefaultComponentFactory.java
Date Fri, 02 Aug 2002 09:10:03 GMT
donaldp     2002/08/02 02:10:03

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/factory
                        DefaultComponentFactory.java
  Log:
  Make component factory cache info objects
  
  Revision  Changes    Path
  1.2       +15 -2     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/DefaultComponentFactory.java
  
  Index: DefaultComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/DefaultComponentFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultComponentFactory.java	2 Aug 2002 05:47:21 -0000	1.1
  +++ DefaultComponentFactory.java	2 Aug 2002 09:10:03 -0000	1.2
  @@ -9,6 +9,7 @@
   
   import org.apache.excalibur.containerkit.infobuilder.ComponentInfoBuilder;
   import org.apache.excalibur.containerkit.metainfo.ComponentInfo;
  +import java.util.HashMap;
   
   /**
    * The default implementation of {@link ComponentFactory}
  @@ -21,6 +22,11 @@
       implements ComponentFactory
   {
       /**
  +     * Cache of ComponentInfo objects.
  +     */
  +    private final HashMap m_infos = new HashMap();
  +
  +    /**
        * The utility class that is used when building info
        * objects for Components.
        */
  @@ -54,7 +60,14 @@
       public ComponentInfo createInfo( final String implementationKey )
           throws Exception
       {
  -        return m_infoBuilder.build( implementationKey, m_classLoader );
  +        ComponentInfo info = (ComponentInfo)m_infos.get( implementationKey );
  +        if( null == info )
  +        {
  +            info = m_infoBuilder.build( implementationKey, m_classLoader );
  +            m_infos.put( implementationKey, info );
  +        }
  +
  +        return info;
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message