Servlets with Multithreading
843841Dec 8 2004 — edited Dec 8 2004Hi,
I am designing an application using JSP and Servlets. I dont have much experience with Threads, and was wondering if the forum could help me out.
The Servlet needs to call multiple stored procedures to get reports on different Deal Types. The different Deal types can be Equities, Bonds, Options etc. I could of course put the whole thing in a loop and then call the different stored procedures one by one to generate the report for each deal type. But this would be time consuming.
I was wondering if i could create a thread per deal type, which would simultaneously get reports for each deal type. The Servlet would return the results to the JSP page only after all the threads have completed. Hence it would wait for all to complete, but if multithreaded all can go on simultaneously and improve performance.
Would this be a good way to develop the system? Can someone point me in the right direction as to how i can achieve this?
Thanks,
Neet