Class JAXBContextCache

java.lang.Object
com.atlassian.crowd.integration.rest.util.JAXBContextCache

public class JAXBContextCache extends Object
Caches the instances of JAXBContext for each entity class for performance reasons as suggested by the JAXB docs. Note that we cache JAXBContext instances because they are thread-safe, but not Marshallers/Unmarshallers because they are not thread-safe. For an extra performance gain, we could have a pool of (un)marshallers in the style of JAXBStringReaderProviders in Jersey Client.
  • Constructor Details

    • JAXBContextCache

      public JAXBContextCache()
  • Method Details

    • getJAXBContext

      public jakarta.xml.bind.JAXBContext getJAXBContext(Class<?> clazz)
      Parameters:
      clazz - class for which a JAXBContext is requested
      Returns:
      a thread-safe JAXBContext for the given class