JiBX not caching marshaller and unmarshaller classes
----------------------------------------------------

                 Key: JIBX-456
                 URL: https://jira.codehaus.org/browse/JIBX-456
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2.3
         Environment: Windows and Linux, JRE 1.6.0_xx, Eclipse equinox OSGi 
container
            Reporter: Wade Poziombka


When running under heavy load we find a lot of blocking on 
ClassLoader.loadClass() of the variety below.  On inspection it appears that 
the caching (m_marshallerClasses and m_unmarshallerClasses members) of 
BindingFactoryBase never cache these classes resulting in repeated calls to 
loadClass.  This has very detrimental impact on performance.  I have patched 
locally to load the classes at the bottom of the constructor as follows:

        if (m_unmarshallers != null)
        {
                for (int i = 0; i < m_unmarshallers.length; ++i)
                {
                        if (m_unmarshallers[i] != null)
                        {
                                m_unmarshallerClasses[i] = 
loadClass(m_unmarshallers[i]);
                        }
                }
            }
            
            if (m_marshallers != null)
            {
                for (int i = 0; i < m_marshallers.length; ++i)
                {
                        if (m_marshallers[i] != null)
                        {
                                m_marshallerClasses[i] = 
loadClass(m_marshallers[i]);
                        }
                }
            }


This significantly improves performance be eliminating lock contention on the 
class loader.  It appears this is the intended behavior from the code.  However 
nowhere in the code are classes assigned to the arrays.  

example of blocking stack.

New I/O client worker #2-7 [BLOCKED] CPU time: 0:44
org.eclipse.osgi.internal.loader.BundleLoader.findImportedSource(String, 
KeyedHashSet)
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(String, 
boolean, ClassLoader)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String, boolean)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(String)
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(String, 
boolean)
java.lang.ClassLoader.loadClass(String)
org.jibx.runtime.impl.BindingFactoryBase.loadClass(String)
org.jibx.runtime.impl.BindingFactoryBase.getMarshallerClass(int)
org.jibx.runtime.impl.MarshallingContext.getMarshaller(String)
<myobject>.marshal(IMarshallingContext)
org.jibx.runtime.impl.MarshallingContext.marshalRoot(Object)
org.jibx.runtime.impl.MarshallingContext.marshalDocument(Object)
...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to