Jun 21st, 2012, 02:43 AM
Spring MDP thread safe resource pooling
Am working Spring migration from EJB2.0. In existing MessageListener we have cached some heavy weight objects since it uses reflection and complex operation in its initial stage such as JAXB objects. Example we have 100 as listener max size, as EJB listener creates 100 objects we don't have thread safety issues. When am trying to work with Spring 2.5, MDP is multithreaded with the single listener object so we have an issue with listner class level objects, we are not able to provide thread objects. Am using Spring.aop.target.CommonsPoolTargetSource and proxyFactoryBean to pool the heavy weight instance, but the instance are not thread safe, it might ruin expectation. I tried to figure out a solution for this issue and I got some inforamtion as we could use class and use process() and we don't want to implement listener class but we need to configure with jmscontainer, but our team wants a standard way to do this. Because the project might grow and it needs a framework pattern followed, needs some standard.
Please help me our to solve this thread-safe resource pooling in the class which implements MessageListener and onMessage as method to get the message. but we need thread safe resource . Am working on this issue for past day and couldn't figure out the issue.
Thanks in advance for suggesting the standard way to resolve this issue.
I've posted the same question
Please some could guide how to utilize stateful resource pooling in the multithreaded environment with thread safety.
Tags for this Thread