Discussions

Web tier: servlets, JSP, Web frameworks: Threads and web container

  1. Threads and web container (5 messages)

    Hi, 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? Thanks.

    Threaded Messages (5)

  2. Re: Threads and web container[ Go to top ]

    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.
  3. Re: Threads and web container[ Go to top ]

    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?
  4. Re: Threads and web container[ Go to top ]

    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.
  5. Re: Threads and web container[ Go to top ]

    thanks, it's clear now.
  6. Re: Threads and web container[ Go to top ]

    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!