-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Craig McClanahan wrote:

> In a thread pooling environment, the same thread will be used to execute
> different servlets at different times.  Is it really worth the overhead of
> renaming it all the time?

true, which is why you would want to put it in the run() method of the
thread which is ready to execute the servlet. i was looking @ the jserv
source code and i think that there are only 2-3 places that threads are
created/used. i think it is worth the overhead because:
1. it provides dynamic runtime information which would be useful in
determining the state of the vm and what is running inside it. currently, we
have a wierd situation @ work here where jrun seems to be creating multiple
threads for no reason whatsoever. we have already named our threads, so it
seems to be jrun which is creating those threads for some unknown reason.
currently, we are resorting to naming those threads in all our servlets in
the service() method to narrow the problem down, but it sure would be nice
if the servlet engine already did that.
2. in the worst case scenario, a new thread will be taking from the pool
each time. in this case, all u will be paying for is a method call --
Thread.setName(). this will probably be inlined by the JIT anyways.
3. in the best case scenario, the same thread might be used again and again.
you could check for the name of the thread and only set it if it is
different. so, most times you might just pay for a string comparision.

> As I pointed out in my previous mail, the list of servlets installed in
the
> servlet engine is different from the list of requests that is actually
being
> executed at any given time.  Apache JServ 1.0 already includes a mechanism
to
> display the installed servlets, through the "/jserv/" URI.

ah, but runtime information is sooo much more useful. you can actually see
what is going on in the vm as it is running. you can also gather statistical
information on which servlets are getting used/abused and need to be
optimized, etc etc

regs,
--------------------------------------
Nimret Sandhu
Dev Geek
EC Direct Corp
http://www.ecdirect.com



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to