解析servicemix上的大文件时jaxb太慢了

问题描述 投票:0回答:1

我正在尝试解析包含100000行的xml文件

方案:

<RplyColl ...>
     <Rply>
            ....
     </Rply>
</RplyColl>
<EnvColl>
    <Env>
        ...
    </Env>
</EnvColl>
<FpdColl rowID="73">
    <Fpd>
        ...
    </Fpd>
</FpdColl>

我像这样解析文件:

        final Unmarshaller unMarshaller = JAXBContext.newInstance("my.context", ObjectFactory.class.getClassLoader()).createUnmarshaller();
        object=  unMarshaller.unmarshal(new StreamSource(new StringReader(new String(message.getBytes(), "UTF-8"))));

我正在使用带有jaxb-impl的servicemix

  90] [Active     ] [            ] [       ] [   50] JAXB2 Basics - Runtime (0.6.4)
[  91] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jaxb-impl (2.2.11.1)

所以当我进入调试模式时,我看到我的jaxbcontext是:

bundle://91.0:1/com/sun/xml/bind/v2/runtime/JAXBContextImpl.class Build-Id: 2.2.11
Classes known to this context:
...
...

在此之后,unmarshal方法调用需要3分30秒:(

我在单元测试中尝试此代码,需要10秒钟,

这是要比较的jaxbcontext类:

jar:file:/D:/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar!/com/sun/xml/bind/v2/runtime/JAXBContextImpl.class Build-Id: 2.2.11
Classes known to this context:
[B
...
...

那么为什么我的servicemix需要3分30秒而且我的单元测试在unmarshall操作期间只需要10秒?

我错过了什么吗?

非常感谢你

jaxb-impl 2.2.11

servicemix:5.5.2

java jaxb apache-servicemix
1个回答
0
投票

最后我找到了答案:

在servicemix中有人更改以下值:

org.apache.servicemix.specs.timeout=100

我把它改成:

org.apache.servicemix.specs.timeout=0

现在它摇滚!

© www.soinside.com 2019 - 2024. All rights reserved.