> From: Johnny Kewl [mailto:[EMAIL PROTECTED]
> Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active
> connections keep increasing....
>
> Sineoa, my feeling is dont use static, unless you really want
> it.... in a multithreaded environment
> It pumps all the threads thru one pipe...

That's completely erroneous.  There are only two differences between static and 
instance methods:

1) Static methods are not associated with any particular object instance of the 
the class (there is no "this" reference available to a static method).  Static 
methods do have access to instance fields, if the method can obtain a reference 
to an instance (passed in as a parameter, static variable, etc.).

2) Static methods are not subject to polymorphism - there's no virtual 
invocation of them.  Consequently, a reference to ClassA.method() will always 
resolve to ClassA.method(), regardless of any super- or sub-classes that ClassA 
might have.

There's no pipe, narrowing highway, or any other throttling or queueing 
mechanism, nor should there be.  Access to static fields, whether it be from 
static or instance variables must always be examined carefully for proper 
synchronization.

As far as Tomcat being thread-safe, all that means is that Tomcat internals are 
guaranteed not to confuse things when multiple threads simultaneously call any 
of the defined servlet APIs, and that Tomcat will dispatch only one thread to 
handle a given request/response.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to