Nic Ferrier wrote:
> ...
> i) as Craig explained, instance pools are ONLY used when you have a
> servlet which implements SingleThreadModel. The reason for that is to
> try and increase throughput to such Servlets.
>
> The spec is explicit about having ONLY ONE instance of a servlet for
> each:
>
> <servlet>...</servlet>
>
> decleration in the web.xml.
>
> ii) if there IS more than one instance then you're right that there
> will be different locks... BUT there will also be different counter
> variables (duh! /8-)
> ...
>
> Yes. It's true that static will do that.
>
> That's why I DIDN'T USE STATIC in my example.
>
> ...
> I'm a member of the team that develops the API (so is Craig). I'm
> telling you (and so was he) that SingleThreadModel is NOT designed to
> be the solution to the problem you think it is.
>
> Honestly.
>
> >but I don't have a testing
>
> You don't need to test this - the spec defines it.
>
> The people who build containers (including myself and Craig) follow
> the spec when building them.
>
> ...
> So this has the same effect as you putting "synchronized" on one of
> your servlet's request methods (eg:
> service(ServletRequest,ServletResponse) ). That's why you shouldn't do
> it that way... because it's not making your servlet thread safe...
> it's making it non-threading.
>
>
> Again... read the spec. Contatiners do not use instance pools EXCEPT
> when dealing with SingleThreadModel servlets.
>
> Nic
>
Hi Nic :-)
0 Did you mean -->
* if my Servlet class doesn't implement SingleThreadModel, then
any Servlet engine will never make more than one instance
for my class?
* if my Servlet class implements SingleThreadModel, then
perhaps some Servlet engines will make instance pool for
my class, and some still make one instance?
please answer this question:
the ONLY one instance of my class will NEVER be
*removed" and "made again", is that right ? :-)
1 even if 0 is right, but in you mail you didn't answer the following question
:-)
is it possible that one Servlet engine will use several
CLassLoader to load my Servlet class more than one time?
if so, then in this case, *static class field* will be failed,
BUT *instance field* will also be failed --> because now
even if there is not a pool for every class, but in fact
there are two instances which are from two ClassLoader,
so now we still have two instances and two "class", and
we still can not get the counter--> you are right, now we
still have two *int counter* :-)
So now, even if *That's why I DIDN'T USE STATIC in my example*,
you still have two *int counter* -- no matter thay are static or not
:-)
so can you make sure that : ANY Servlet engine will NEVER use more than one
ClassLoader to load my Servlet class several times? -- please answer this
question:
* is it possible that my class wil be *load* and "unload" several times? :-)
2 another problem -- *hot plugin* :-)
for example,
now I want to update my class, and just as this time,
there are several threads which are *from* my old class
are running, in this case, is there such Servlet engine
which will support *hot plugin"? :-) if so, now there
will be two version of my class in this Servlet engine
at this time -- just my guessing :-)
BTW, even if 2 is right, but because I don't think
now the old version and new version of my class
are the same one, so I don't use it to *argue* to
you :-)
BTW, are you sure that all the Servlet engines which are
running now will *follow" the *specifacation* mentioned
in your email? what is the version of your
*specifacation*?
Bo
Nov.03, 2000
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html