You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steffen Heil <li...@steffen-heil.de> on 2005/04/06 00:43:13 UTC

Threads / Tomcat Lite

Hi

1. Question

I need to store some information which differs for each request.
My problem: I need it at a place where I have no access to the request, the
response or the session.

Now, I can also do it using ThreadLocal variables, but these take time.
I would prefer to use a custom Thread class for the Processors and to extend
that by an aditional variable.
I could then cast Thread.currentThread() to my own Thread class and use the
variable.

So, is it possible to specify, which class is used?


2. Question

Is it possible to use the HTTP connector of tomcat only?
Everything I have is served by a single servlet. I do NOT need logging,
filters, mappings (other than the single one), and so on.
Every request goes all the way through tomcat's valves and filters. This
takes a little time. A little time I'd like to save.

Any way?


Regards,
  Steffen

Re: Threads / Tomcat Lite

Posted by Remy Maucherat <re...@gmail.com>.
On Apr 6, 2005 12:43 AM, Steffen Heil <li...@steffen-heil.de> wrote:
> Hi
> 
> 1. Question
> 
> I need to store some information which differs for each request.
> My problem: I need it at a place where I have no access to the request, the
> response or the session.
> 
> Now, I can also do it using ThreadLocal variables, but these take time.
> I would prefer to use a custom Thread class for the Processors and to extend
> that by an aditional variable.
> I could then cast Thread.currentThread() to my own Thread class and use the
> variable.
> 
> So, is it possible to specify, which class is used?

Well, you should have looked at the thing returned by
Thread.currentThread() first, I think. This would have answered all
your questions.
However, ThreadLocals are fast and efficient, so I recommend you use them.

> 2. Question
> 
> Is it possible to use the HTTP connector of tomcat only?
> Everything I have is served by a single servlet. I do NOT need logging,
> filters, mappings (other than the single one), and so on.
> Every request goes all the way through tomcat's valves and filters. This
> takes a little time. A little time I'd like to save.
> 
> Any way?

Overhead added is negigible (really, I mean it), so I recommend you
don't bother. Although you may not need some of the features, I think
you are probably using IO.

The Tomcat HTTP core (which is indeed fully independent, so you could
use it as a HTTP server) basically only allows using byte arrays for
IO, which is more restrictive obviously.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

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