[ 
https://issues.apache.org/jira/browse/CXF-4703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-4703.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.2
                   2.6.5
                   2.5.8
    
> CXF loading performance
> -----------------------
>
>                 Key: CXF-4703
>                 URL: https://issues.apache.org/jira/browse/CXF-4703
>             Project: CXF
>          Issue Type: Improvement
>          Components: Bus
>    Affects Versions: 2.7.0
>         Environment: CXF with Spring on Tomcat server
>            Reporter: E Chaplet
>            Assignee: Daniel Kulp
>              Labels: performance
>             Fix For: 2.5.8, 2.6.5, 2.7.2
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Context : A lot of beans managed by Spring (more than 2500 beans) and about 
> 120 endpoints managed by CXF
> The loading time of the 120 web services is approximately 4 minutes, too long 
> for me !!
> I identified an area for improvement :
> * CXFBusImpl
> Slowness comes from getExtension(Class<T> extensionType) method
> => loc.getBeansOfType(ExtensionType);
> Here, Spring is looking for beans of a Class in his big context...
> Great, but if no beans are found, the next time this method is called with 
> the same Class, this method is looking again in Spring beans (by 
> getBeansOfType) !!!
> it can be easily improved by adding an emptyBeanExtensions Set which goal is 
> to identify wich Class has no Spring beans.
> Exemple (I saved more than 1 minute loading time with this code):
> public final <T> T getExtension(Class<T> extensionType)
>     {
>         Object obj = extensions.get(extensionType);
>         if (obj == null && !emptyExtensions.contains(extensionType))
>         {
>             ConfiguredBeanLocator loc = (ConfiguredBeanLocator) 
> extensions.get(ConfiguredBeanLocator.class);
>             if (loc == null)
>             {
>                 loc = createConfiguredBeanLocator();
>             }
>             if (loc != null)
>             {
>                 //force loading
>                 Collection<?> objs = loc.getBeansOfType(extensionType);
>                 if (objs != null)
>                 {
>                     if (objs.isEmpty())
>                     {
>                         emptyExtensions.add(extensionType);
>                     }
>                     else
>                     {
>                         for (Object o : objs)
>                         {
>                             extensions.put(extensionType, o);
>                         }
>                         obj = extensions.get(extensionType);
>                     }
>                 }
>             }
>         }
>         if (null != obj)
>         {
>             return extensionType.cast(obj);
>         }
>         return null;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to