JAXB to use Woodstox parser for performance?

跟風遠走 提交于 2019-12-21 18:39:54

问题


Is it possible switch the native parser, which I believe is based on Java reflection. We have some performance issues and wondering whether we can switch the implementation.

Your advise is highly appreciated.

Additional information: This is inherited code and we need to fix performance issues in our web-services. I am looking for performance boost without code changes. The existing code uses JAXB for marshalling and unmarshalling java objects which are generated via CXF (wsdl to java).

My goal is to switch the implementation to sTax and then use Woodstox library.


回答1:


If your JAXB implementation uses a StAX parser under the covers via the standard JAXP APIs, then adding the Woodstox jar to your classpath should cause your JAXB impl to use Woodstox. You should see a performance improvement by doing this.

Since the Woodstox jar contains the following entries, adding it to the classpath will allow the JAXP APIs to return an instance of it:

  • META-INF/services/javax.xml.stream.XMLInputFactory
  • META-INF/services/javax.xml.stream.XMLOuputFactory

Note: I lead EclipseLink JAXB (MOXy), and MOXy uses a StAX parser when one is available. The other JAXB implementations (Metro, JaxMe) probably do the same thing.



来源:https://stackoverflow.com/questions/5477842/jaxb-to-use-woodstox-parser-for-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!