On 20 June 2011 17:02, Christopher Schultz <ch...@christopherschultz.net> wrote:
> That depends on what Service.logHit does. If it only uses the
> HttpServletRequest object during the method's lifetime, then everything
> is fine. If it retains a reference to the request object, you will
> probably end up with a problem.

Oh, just gets the remoteAddr, requestURI, user-agent etc, and logs it
to a DB, for example.

> Tomcat re-uses the same request and response objects for a long time,
> and so multiple request processor threads will see the same object over
> the life of the server. If any of that code retains a reference to the
> request, by the time the object is re-referenced by the same code for
> whatever reason, the object will have "moved on" and will almost
> certainly be invalid (from the perspective of the code that cached it)
> and might /actually/ be invalid (because it is between requests and
> Tomcat has actively invalidated it).

I assume that Tomcat won't reuse a request/response until activity on
it has ended though?
Does it keep a pool of them?

Thanks for your help in clarifying this for me, by the way.

Calum

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to