XFire

JaxbContext is created on everey request

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.2.4, 1.2.5, 1.2.6
  • Fix Version/s: 1.2.4, 1.2.5, 1.2.6, 1.2.7
  • Component/s: JAXB 2.0
  • Labels:
    None
  • Environment:
    Windows server 2003, IBM JVM 1.5
  • Number of attachments :
    0

Description

Whe xfire performs a SOAP request where the binding of XML to Java and vice versa is done by using JAXB 2.0 the JaxbContext is created on every request. Creating a JaxbContext is a very long running function, particular with large schema's and a large Java codebase where annotations defining the JAXB binding is descibed.

The method getJAXBContext of the type "org.codehaus.xfire.jaxb2.JaxbType" should cache the JaxbContext for later use to avoid paying the performance overhead of creating a new JaxbContext.

A similar issue is reported on CXF: https://issues.apache.org/jira/browse/CXF-850

The fix could look something like this:

if (cachedContexts.containsKey(pckg) == false)
{
synchronized(cachedContexts)
{
if (cachedContexts.containsKey(pckg) == false) { cachedContexts.put(pckg, JAXBContext.newInstance(pckg)); }
}
context = cachedContexts.get(pckg);
}

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: