Crie uma nova instância do JAXB Marshaller no método estático ... é ThreadSafe?
Eu implementei uma classe util com o seguinte método estático:
public static String objToXml(JAXBContext jaxbContext, ClassA obj) throws Exception{
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
StringWriter writer = new StringWriter();
marshaller.marshal(obj, writer);
return writer.toString();
}
Meu entendimento é que o JAXB Marshaller e o StringWriter são ambos thread-safe ... mas quero confirmar duas vezes se eu implementar um método estático como este .. e tiver vários threads chamando o método objToXml simultaneamente, haveria algum problema em potencial?