Sunday, August 3, 2008

J2EE and custom multi-threading code.

Since the inception of J2EE, it was strongly discouraged to write custom multi-threaded application running in a J2EE container that might interfere with the container's thread management. In my current project, which is a spring and hibernate application running in JBOSS we have a library that's multi-thread and we believe that's causing some of the site failures today. I was assigned the task of researching alternate solutions for it. We have a long running transaction that get's account information from mainframe. The queueing mechanism for these requests is synchronous block of code. So under high load and poor performance from mainframe, all the request threads waiting to get account information are blocked trying to get into this synchronous block of code. Two solutions were proposed by my colleages. One was to use JMS. Other was to use web services and use alternate queuing mechanism instead. Thinking about JMS, I don't think this solution will work here as we need upto date account information real-time to get lot of features on the site working and also JMS is meant to be reliable solution, but heavy which suits more for order placement etc. Here is an article I was reading on the topic.

http://www.geocities.com/sundar_rajan_in/java/jms/intro.html

No comments: