(Moving my comment to the answer)
Do you create a JAXBContext every time? JAXBContext is thread safe and must be created once and reused. Unmarshaller is not thread safe; a new one must be created for the thread.
Now I support the map (ConcurrentHashMap contexts) wrapped in stream safe code for storing all JAXBContexts (one by type) at the moment it works beautifully. Any other best suggestion ??
It depends on your application. You can also create one JAXBContext for many classes:
JAXBContext jc = JAXBContext.newInstance(A.class, B.class, C.class, D.class);
or
JAXBContext jc = JAXBContext.newInstance("com.foo:org.bar");
source share