解组线程安全吗?

Joe*_*tov 3 soap jaxb thread-safety

我正在使用该方法

javax.xml.bind.Unmarshaller.unmarshal(Source source, Class<RX> declaredType) 
Run Code Online (Sandbox Code Playgroud)

并且想知道这个方法是否是线程安全的。否则我将不得不在每次调用时实例化一个解组器

bdo*_*han 8

Unmarshaller.unmarshal 不是线程安全的。

来自:https : //javaee.github.io/jaxb-v2/doc/user-guide/ch03.html#other-miscellaneous-topics-performance-and-thread-safety

JAXBContext 类是线程安全的,但 Marshaller、Unmarshaller 和 Validator 类不是线程安全的。