You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "E Chaplet (JIRA)" <ji...@apache.org> on 2012/12/14 15:30:13 UTC

[jira] [Created] (CXF-4703) CXF loading performance

E Chaplet created CXF-4703:
------------------------------

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


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