tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Rewrite features
Date Thu, 03 Nov 2005 20:02:10 GMT

----- Original Message -----
From: "Costin Manolache" <costin@gmail.com>
To: "Tomcat Developers List" <dev@tomcat.apache.org>
Sent: Thursday, November 03, 2005 11:30 AM
Subject: Re: Rewrite features


On 11/3/05, Bill Barker <wbarker@wilshire.com> wrote:
>> It probably doesn't matter (since nobody uses it :), but using
ThreadLocal
>> won't work with the Nio/AJP Connector.  That one doesn't bind a Request
>> instance to a Thread instance, so a particular Request instance will
process
>> on many different Threads during its lifecycle.
>
>Does the spec say anything about the thread model when executing a
>servlet ? ( too lazy to search, I know some people on the list have
>memorized the spec already :-)

When an AJP Request comes in, the Connector gets a Thread from the Pool to
process the Request.  After the Request is done processing, it returns the
Thread to the Pool.  There is no reason that it should get the same Thread
instance each time it does this.

>
>I'm not sure how this happens - I tought that the request is bound to
>a thread during service() execution, and kept-alive connections are no
>longer bound. How do we unbind the service() from the thread ???
>

We don't unbind the service() from the Thread.  However, in Coyote Request
instances are very long lived objects that (at least for HTTP/1.1) persist
over many connections.

The APR Connector uses a ThreadLocal to bind the Request instance to a
single Thread instance.  The next request that it handles may have been
received on a different Socket than the last, but it is bound to the Thread.
With the Java HTTP/1.1 Connector, the Request is bound to the Thread via the
init() method of ThreadPoolRunnable.

The Nio/AJP Connector binds the Request instance to a Socket connection (via
the SelectionKey.attachment).

>
>Costin



This message is intended only for the use of the person(s) listed above as the intended recipient(s),
and may contain information that is PRIVILEGED and CONFIDENTIAL.  If you are not an intended
recipient, you may not read, copy, or distribute this message or any attachment. If you received
this communication in error, please notify us immediately by e-mail and then delete all copies
of this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet
is not secure. Do not send confidential or sensitive information, such as social security
numbers, account numbers, personal identification numbers and passwords, to us via ordinary
(unencrypted) e-mail.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message