Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 331
Joel Shemtov Avatar asked Jun 13 '26 06:06

Joel Shemtov


1 Answers

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.

like image 104
bdoughan Avatar answered Jun 17 '26 10:06

bdoughan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!