I work on a web application which launches a thread when a user activates a given process. I would like to know if it is a good idea to run a thread in a web container. What are the impacts in terms of performance, scalability, resource management?
don't , don't ,don't (times 10).
you should spawn threads from "user thread" servlet. I recommend you always spawn threads behind the scene outside the web tier where it can be more managed.
Thanks for your answer.
But, "user thread" servlet is also in the web tier,isn't it? is it possible to start a thread outside the web tier from a web application?
i think i worded my response wrong,
i basically mean, don't spawn threads that cannot be "managed" ...for example if you use Quartz(JDBC) the "Jobs"(threads), are maintained by the quartz/database. or of course if u are implementing EJBs, the message driven beans are managed by the J2EE application server.
it's clear now.
I'm confused now!
I'm not sure whether a thread spawned from a servlet will run inside a web container or not,but i found the fact that the new thread(spawned from a servlet) can't locate the DataSource defined by the WAS Web Container,but the servlet itself(running inside the web container) can find it and use it!