We are analyzing our springboot MQ listner application in order to evaluate performances. During method hotspots analysis we notice JAXB library spends 60% in lock time calling
Constructor.newInstance
.
We use this code in order to create constructur and to unmarshal our input bytes
JAXBContext context = JAXBContext.newInstance(ApplicationData.class);
ApplicationData aData = (ApplicationData) context.createUnmarshaller()
.unmarshal(new StringReader(new String(input)));
We call this code snippet every time we read a new message from our MQ queue. It should be a singleton by design, but: shoulde we create it once and use the same context? Maybe in a static way?
Thanks to all.