Scott Evans wrote:

> Is it reasonable to assume that the thread of execution that represents a
> request ceases execution after the request has been fulfilled?
> I ask because I'd like to know if in my controller servlet I can maintain a
> list of currently executing requests.
>

>From the perspective of your servlet, it looks like the thread ceases execution.
What actually happens, though, is dependent on the internals of your servlet
container.  For example, Tomcat recycles request processing threads so that it
doesn't have to create new ones every time.  For the same reason, the request and
response objects themselves are also recycled.

>
> I imagined getting the current thread my using Thread currentThread =
> Thread.getCurrentThread(), adding a identifier for it to a list, and start
> another thread to track the current Thread's progress by using
> currentThread.join(). Then when the currentThread ceases executing the
> tracker thread removes the identifier from the list.
>
> I'm guessing that this assumes too much about the underlying Servlet/JSP
> container.
>

It makes assumptions about the implementation that are not in the spec, so they are
container specific.  That sounds like "assumes too much" to me.

>
> Scott
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to