Joel Shemtov
Joel Shemtov

Reputation: 3078

Is unmarshalling thread safe?

I'm using the method

javax.xml.bind.Unmarshaller.unmarshal(Source source, Class<RX> declaredType) 

and would like to know if this method is thread safe. Otherwise I will have to instantiate an Unmarshaller on each call

Upvotes: 3

Views: 3365

Answers (1)

bdoughan
bdoughan

Reputation: 149047

Unmarshaller.unmarshal is not thread safe.

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

The JAXBContext class is thread safe, but the Marshaller, Unmarshaller, and Validator classes are not thread safe.

Upvotes: 10

Related Questions