JAXB creating context and marshallers cost

后端 未结 8 2112
情深已故
情深已故 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:35

    Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group.

    JAXBContext is thread safe and should only be created once and reused to avoid the cost of initializing the metadata multiple times. Marshaller and Unmarshaller are not thread safe, but are lightweight to create and could be created per operation.

提交回复
热议问题