JAXB creating context and marshallers cost

后端 未结 8 2132
情深已故
情深已故 2020-11-28 02:00

The question is a bit theoretical, what is the cost of creating JAXB context, marshaller and unmarshaller?

I\'ve found that my code could benefit from keeping the sa

8条回答
  •  长情又很酷
    2020-11-28 02:34

    Ideally, you should have a singleton JAXBContext and local instances of Marshaller and Unmarshaller.

    JAXBContext instances are thread-safe while Marshaller and Unmarshaller instances are not thread-safe and should never be shared across threads.

提交回复
热议问题