Results 1 to 3 of 3

Thread: thread safety when using spring WebServiceTemplate and Jaxb2Marshaller

  1. #1
    Join Date
    Jan 2008
    Posts
    11

    Default thread safety when using spring WebServiceTemplate and Jaxb2Marshaller

    I am using spring WebServiceTemplate as a web service client programmatically i.e. without instantiating a spring container. I am using Jaxb2Marshaller for marshaling/unmarshaling. In my application, I create a single instance of the SaajSoapMessageFactory and one instance of Jaxb2Marshaller. I also create a single instance of the WebServiceTemplate and assign the previously created instances of SaajSoapMessageFactory and Jaxb2Marshaller.

    The WebServiceTemplate I created is used in a multi threaded way i.e. multiple threads can call marshalSendAndReceive at the same time. My question is - is my configuration thread safe? I am concerned about the Jaxb2Marshaller. The javadoc says Jaxb2Marshallers are not necessarily thread safe. How can I use the Jaxb2Marshaller in a thread safe way without reinitializing the Jaxb context?

    As an aside: looking at the example spring-ws configuration in the spring reference[http://static.springsource.org/sprin...oxm-jaxb2-xsd] leads me to believe that the Jaxb2Marshaller is thread safe but the Javadoc seems to contradict that.

  2. #2
    Join Date
    Jan 2008
    Posts
    11

    Default

    In case some one stumbles upon this question, I posted the same question here and got an answer:

    http://stackoverflow.com/questions/3...axb2marshaller

  3. #3
    Join Date
    Apr 2010
    Posts
    16

    Default

    It looks like they are thread safe. According to the Spring WS release notes (http://sourceforge.net/project/shown...oup_id=73357):
    Changes in version 1.0-M1 (12-6-2006)
    -------------------------

    Package org.springframework.oxm.jaxb
    * added support for JAXB 2: refactored JaxbMarshaller into AbstractJaxbMarshaller, Jaxb1Marshaller and Jaxb2Marshaller
    * made JaxbMarshallers thread safe
    * added property for a ValidationEventHandler

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •