Jay Roy
asked on
Spring multithreading issue
Dear experts
I am facing a multi threading issue in our spring environment.
I have two classes
both above classes are using jaxbConversionManager object.
Document message passed to method1() from Class1 was actually visible in Class2.method2() , i was able to confirm that in the log statement
LOGGER.info("Customer object2 is", customer.toString()); --> prints message which came to method1
This is most probably because jaxbConversionManager is not threadsafe. Any idea how i can make it threadsafe in a spring way.
Thanks
I am facing a multi threading issue in our spring environment.
In spring-config.xml we have
<bean id="jaxbConversionManager" class="com.junta.util.JAXBConversionManager"/>
JAXBConversionManager.java has unmarshal method
public class JAXBConversionManager{
@SuppressWarnings("unchecked")
public <T> T unmarshal(Document msg) {
//convert from xml to object and return
}
}
I have two classes
public Class1 implements MessageListener{
@Autowired
private JAXBConversionManager jaxbConversionManager;
private void method1(Document message) throws Exception {
Customer customer = jaxbConversionManager.unmarshal(message);
LOGGER.info("Customer object1 is", customer.toString());
moveForward(customer);
}
}
public Class2 implements MessageListener{
@Autowired
private JAXBConversionManager jaxbConversionManager;
private void method2(Document message) throws Exception {
Customer customer = jaxbConversionManager.unmarshal(message);
LOGGER.info("Customer object2 is", customer.toString());
moveForward(customer);
}
}
both above classes are using jaxbConversionManager object.
Document message passed to method1() from Class1 was actually visible in Class2.method2() , i was able to confirm that in the log statement
LOGGER.info("Customer object2 is", customer.toString()); --> prints message which came to method1
This is most probably because jaxbConversionManager is not threadsafe. Any idea how i can make it threadsafe in a spring way.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER