java-XMLInputFactory线程安全吗?
作者:互联网
在对应用程序进行性能分析时,我注意到一遍又一遍地创建XMLInputFactory实例非常昂贵.在多个线程之间共享其实例是否安全?
Javadoc没有任何关于其线程安全性的信息,并且在互联网上搜索并不能给出明确的答案!
解决方法:
我决定使用Woodstox作为StAX实现.两者都比默认的JDK实现和explicitly mentions thread safety快得多.
Woodstox factories are thread-safe after configuration phase (calling setProperty()), but not during it. Most importantly, once all configuration is done, calling ‘createXMLxxx’ methods is fully thread-safe.
标签:stax,java-7,xml,java 来源: https://codeday.me/bug/20191122/2057401.html