在ServiceMix上解析大文件时,JAXB太慢了



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

schéma喜欢:

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

之后,unmarshall方法调用以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在Unmarshall操作期间仅需10秒钟的ServiceMix进行3分钟30秒的秒?

我想念什么吗?

非常感谢

版本

jaxb-impl 2.2.11

servicemix:5.5.2

最后我找到了答案:

在servicemix中某人更改:

的值
org.apache.servicemix.specs.timeout=100

我将其更改为:

org.apache.servicemix.specs.timeout=0

现在它摇滚!

最新更新