My name is Bernie Lavallee and I work in a financial institution in Vermont. I've been developing in Java since 1988. I currently develop Web applications in Java using Websphere, Struts, Ajaz, Ibatis and occasionally portlets. I also programmed for 20 years on the IBM miniseries (S38 and AS400).
My question for the forum is as follows:
I have a Java web application which accepts input over several screens and culminates in the production of a PDF document. The production of PDF is a relatively slow process interactively so I've spawned it off to a separate thread provided by a thread pool. It now produces the PDF asynchronously and allows the app to progress quite rapidly.
I've created the thread pool at the servlet context level and within each session request a thread as needed to produce a PDF for that particular session user. Each thread has three class level variables, each containing passed in data needed to populate the PDF's fields.
My question is by creating the threadpool at context or application level am I violating individual session integrity for each user? That is, is the thread acting like a global variable? Should I create the thread pool within each session, although this would seem to defeat the purpose of reducing overhead for each session? I know using class level variables in the thread class is not cool but I know of no other way of passing in the needed data to product the PDF. Any thoughts there as well.
Thanks in advance