HowTo Change default Pool MaxSize for SingleThreadModel Servlets

2005-06-16 Thread Martín Cabrera
Hi all;

I have a servlet that implements the SingleThreadModel interface. I have
noticed that, under heavy weight, tomcat is restricting the servlet pool
size to 22 instances. My question is: How can I do to change this limit?

Regards.
Martín.

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HowTo Change Pool MaxSize for SingleThreadModel Servlets

2005-06-14 Thread 孙业海
Mart?_Cabrera,您好!

I think you can use singlton pattern!

=== 2005-06-14 16:48:00 您在来信中写道:===

>Hi all;
>
>How can I do to change the default pool size for SingleThreadModel servlets?
>
>Regards.
>Mart?.
>
>--
>No virus found in this outgoing message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =


致
礼!


孙业海
[EMAIL PROTECTED]
  2005-06-15





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HowTo Change Pool MaxSize for SingleThreadModel Servlets

2005-06-14 Thread 孙业海
Mart?_Cabrera,您好!

I think you can use singlton pattern!

=== 2005-06-14 16:48:00 您在来信中写道:===

>Hi all;
>
>How can I do to change the default pool size for SingleThreadModel servlets?
>
>Regards.
>Mart?.
>
>--
>No virus found in this outgoing message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =


致
礼!


孙业海
[EMAIL PROTECTED]
  2005-06-15





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: HowTo Change Pool MaxSize for SingleThreadModel Servlets

2005-06-14 Thread Martín Cabrera
Pawan;

I suggest you start a new thread instead of replying this way.

Regards.
Martín. 

-Mensaje original-
De: Pawan Choudhary [mailto:[EMAIL PROTECTED] 
Enviado el: Martes, 14 de Junio de 2005 05:17 p.m.
Para: Tomcat Users List
Asunto: Re: HowTo Change Pool MaxSize for SingleThreadModel Servlets

Hi all
   What are the different extension mechanism for Tomcat or in other words
how do we extend Tomcat. Can we write some plug-in in Tomcat environment.
  From what I have gathered till now it looks like Tomcat's server.xml file
can be customized for className attibute etc. Apart from this what are the
different extension point to Tomcat.

Thanks all,

Pawan

On 6/14/05, Martín Cabrera <[EMAIL PROTECTED]> wrote:
> Hi all;
> 
> How can I do to change the default pool size for SingleThreadModel
servlets?
> 
> Regards.
> Martín.
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


--
---
Pawan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HowTo Change Pool MaxSize for SingleThreadModel Servlets

2005-06-14 Thread Pawan Choudhary
Hi all
   What are the different extension mechanism for Tomcat or in other
words how do we extend Tomcat. Can we write some plug-in in Tomcat
environment.
  From what I have gathered till now it looks like Tomcat's server.xml
file can be customized for className attibute etc. Apart from this
what are the different extension point to Tomcat.

Thanks all,

Pawan

On 6/14/05, Martín Cabrera <[EMAIL PROTECTED]> wrote:
> Hi all;
> 
> How can I do to change the default pool size for SingleThreadModel servlets?
> 
> Regards.
> Martín.
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
---
Pawan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HowTo Change Pool MaxSize for SingleThreadModel Servlets

2005-06-14 Thread Martín Cabrera
Hi all;

How can I do to change the default pool size for SingleThreadModel servlets?

Regards.
Martín.

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 267.6.6 - Release Date: 08/06/2005
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Number of instances with SingleThreadModel

2003-11-14 Thread cyril vidal
thanks all for your responses.

Regards,
Cyril.

- Original Message -
From: "Remy Maucherat" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 2:57 PM
Subject: Re: Number of instances with SingleThreadModel


> cyril vidal wrote:
>
> > Hi,
> >
> > These infos are useful but have nothing to deal with my initial
question;-))
> > So, I ask it again, if some people know about THIS subject:
> >
> > is it possible in Tomcat's configuration to specify
> > the number of servlet instances created when this servlet implements the
> > javax.servlet.SingleThreadModel interface.
>
> No. The value is 20 instances.
>
> There's a constant you can change in the StandardWrapper class, of
> course, and a parameter could be added in StandardContext to set it.
>
> --
> x
> Rémy Maucherat
> Senior Developer & Consultant
> JBoss Group (Europe) SàRL
> x
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Number of instances with SingleThreadModel

2003-11-14 Thread Christopher Schultz
Tim,
SingleThreadModel is also deprecated in 2.4 Servlet API
Woo hoo!

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Number of instances with SingleThreadModel

2003-11-14 Thread Tim Funk
SingleThreadModel is also deprecated in 2.4 Servlet API

-Tim



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Number of instances with SingleThreadModel

2003-11-14 Thread Remy Maucherat
cyril vidal wrote:

Hi,

These infos are useful but have nothing to deal with my initial question;-))
So, I ask it again, if some people know about THIS subject:
is it possible in Tomcat's configuration to specify
the number of servlet instances created when this servlet implements the
javax.servlet.SingleThreadModel interface.
No. The value is 20 instances.

There's a constant you can change in the StandardWrapper class, of 
course, and a parameter could be added in StandardContext to set it.

--
x
Rémy Maucherat
Senior Developer & Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Number of instances with SingleThreadModel

2003-11-14 Thread Shapira, Yoav

Howdy,

>These infos are useful but have nothing to deal with my initial
question;-

Yes, don't you hate it when people hijack threads?

>is it possible in Tomcat's configuration to specify
>the number of servlet instances created when this servlet implements
the
>javax.servlet.SingleThreadModel interface.

No, it's not possible to specify.

SingleThreadModel is evil, don't use it.  If you're curious why, search
the archives of this list.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Number of instances with SingleThreadModel

2003-11-14 Thread cyril vidal
Hi,

These infos are useful but have nothing to deal with my initial question;-))
So, I ask it again, if some people know about THIS subject:

is it possible in Tomcat's configuration to specify
the number of servlet instances created when this servlet implements the
javax.servlet.SingleThreadModel interface.

Thanks in advance for your response,
Regards,
Cyril.

Please don't use this thread to initiate another subject...

- Original Message -
From: "Jon Wingfield" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 10:58 AM
Subject: Re: Number of instances with SingleThreadModel


> Useful methods on the Runtime class:
> In jdk 1+  Runtime.getRuntime().getTotalMemory();
> In jdk 1+  Runtime.getRuntime().getFreeMemory();
> In jdk 1.4 Runtime.getRuntime().getMaxMemory();
> These methods are diagnostic. You'll need to find out why you are
> getting OutOfMemory errors. Time to profile your app...
>
> HTH,
>
> Jon
>
>
> Neal wrote:
>
> > Does anyone know how I can check to see how much memory is in use or
> > available on Tomcat at any point in time?  I've been getting a
> > java.error.OutOfMemory error lately and I need to be able to track
> > what's going on.
> >
> > Thanks.
> > Neal
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Number of instances with SingleThreadModel

2003-11-14 Thread Jon Wingfield
Useful methods on the Runtime class:
In jdk 1+  Runtime.getRuntime().getTotalMemory();
In jdk 1+  Runtime.getRuntime().getFreeMemory();
In jdk 1.4 Runtime.getRuntime().getMaxMemory();
These methods are diagnostic. You'll need to find out why you are 
getting OutOfMemory errors. Time to profile your app...

HTH,

Jon

Neal wrote:

Does anyone know how I can check to see how much memory is in use or
available on Tomcat at any point in time?  I've been getting a
java.error.OutOfMemory error lately and I need to be able to track
what's going on.
Thanks.
Neal


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Number of instances with SingleThreadModel

2003-11-14 Thread Neal
Does anyone know how I can check to see how much memory is in use or
available on Tomcat at any point in time?  I've been getting a
java.error.OutOfMemory error lately and I need to be able to track
what's going on.

Thanks.
Neal



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Number of instances with SingleThreadModel

2003-11-14 Thread cyril vidal
Hi,

I would like to know if it is possible in Tomcat's configuration to specify
the number of servlet instances created when this servlet implements the
javax.servlet.SingleThreadModel interface.

Thanks in advance for your response,
Regards,
Cyril.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Bug ? Init is called twice in SingleThreadModel

2003-07-09 Thread Hal Lander
I modified my init method as suggested by Yoav.
The new init() and its output are shown below.
The addresses printed are different so it appears I have two instances of my 
servlet. Bill said that "instance-pooling for STM Servlets" is normal 
behaviour.

I was expecting that, since I am the only person calling the servlet, only 
one instance would be created and initialised. I guess Tomcat is being 
clever and getting a second one ready just in case it is needed.

Where can I learn about this behaviour and get control over the number of 
instances created?



public void init()
//
{
System.out.println("init called "+toString());
System.out.println("init call 2 "+toString());
return;
}
Starting service Tomcat-Standalone
Apache Tomcat/4.0.4
Starting service Tomcat-Apache
Apache Tomcat/4.0.4
init called [EMAIL PROTECTED]
init called [EMAIL PROTECTED]
Regards
Hal
P.S. Thanks Yoav & Bill.

_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Bug ? Init is called twice in SingleThreadModel

2003-07-02 Thread Bill Barker
By default, all current released versions of Tomcat (i.e. 3.3.1-5.0.3)
implement instance-pooling for STM Servlets.  The servlet-spec explicitly
allows the Container (aka Tomcat) to implement STM Servlets this way, so,
no, it is not a bug.  You should expect to get multiple instances of your
Servlet, and hence multiple calls to init.

"Hal Lander" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The init method of my servlet is called twice if my class implements the
> SingleThreadModel.
> Full details are given below. If I remove "implements SingleThreadModel"
> init is called only once - as I would expect.
>
> Is this a bug?
> Any help would be appreciated.
>
> Hal.
>
>
>
> THE SOURCE CODE
> 
> import javax.servlet.http.HttpServlet;
> import javax.servlet.SingleThreadModel;
>
> public class x extends HttpServlet implements SingleThreadModel
> //
> {
> public void init()
> //
> {
> System.out.println("init called");
> return;
> }
> }
>
>
> URL USED TO INVOKE SERVLET
> ==
> http://localhost:8080/examples/servlet/x
>
>
>
> OUTPUT IN "START TOMCAT" WINDOW
> ===
> Starting service Tomcat-Standalone
> Apache Tomcat/4.0.4
> Starting service Tomcat-Apache
> Apache Tomcat/4.0.4
> init called
> init called
>
>
> localhost_examples_log.2003-06-27.txt
> =
> 2003-06-27 11:39:09 WebappLoader[/examples]: Deploying class repositories
to
> work directory C:\Program Files\Apache Tomcat
> 4.0\work\Standalone\localhost\examples
> 2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR
> /WEB-INF/lib/httpclient.jar to C:\Program Files\Apache Tomcat
> 4.0\webapps\examples\WEB-INF\lib\httpclient.jar
> 2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR
> /WEB-INF/lib/logging.jar to C:\Program Files\Apache Tomcat
> 4.0\webapps\examples\WEB-INF\lib\logging.jar
> 2003-06-27 11:39:09 WebappLoader[/examples]: Reloading checks are enabled
> for this Context
> 2003-06-27 11:39:09 StandardManager[/examples]: Seeding random number
> generator class java.security.SecureRandom
> 2003-06-27 11:39:09 StandardManager[/examples]: Seeding of random number
> generator has been completed
> 2003-06-27 11:39:09 ContextConfig[/examples]: Added certificates ->
request
> attribute Valve
> 2003-06-27 11:39:09 ContextConfig[/examples]: Configured an authenticator
> for method FORM
> 2003-06-27 11:39:09 ContextListener: contextInitialized()
> 2003-06-27 11:39:09 SessionListener: contextInitialized()
> 2003-06-27 11:39:09 ContextListener:
> attributeReplaced('org.apache.catalina.WELCOME_FILES',
> '[Ljava.lang.String;@1f6226')
> 2003-06-27 11:39:09 StandardWrapper[/examples:default]: Loading container
> servlet default
> 2003-06-27 11:39:09 default: init 2003-06-27 11:39:09
> StandardWrapper[/examples:invoker]: Loading container servlet invoker
> 2003-06-27 11:39:09 invoker: init 2003-06-27 11:39:09 jsp: init 2003-06-27
> 11:39:45 org.apache.catalina.INVOKER.x: init
> 2003-06-27 11:39:45 org.apache.catalina.INVOKER.x: init
> 2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Servlet
> Mapped Filter, filterClass=filters.ExampleFilter]): 20 milliseconds
> 2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Path Mapped
> Filter, filterClass=filters.ExampleFilter]): 20 milliseconds
> 2003-06-27 11:40:04 SessionListener: contextDestroyed() 2003-06-27
11:40:04
> ContextListener: contextDestroyed()
> 2003-06-27 11:40:04 org.apache.catalina.INVOKER.x: destroy 2003-06-27
> 11:40:04 org.apache.catalina.INVOKER.x: destroy
>
> _
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Bug ? Init is called twice in SingleThreadModel

2003-07-02 Thread Shapira, Yoav

Howdy,

>The init method of my servlet is called twice if my class implements
the
>SingleThreadModel.
>Full details are given below. If I remove "implements
SingleThreadModel"
>init is called only once - as I would expect.
>
>Is this a bug?
>Any help would be appreciated.

Instead of just printing out "init called" or whatever you did, print
out "init called " + toString() which will have the memory address of
the servlet instance.  This will allow you to see that the instances are
different, i.e. you have two instances of this servlet with init being
called one for each (proper behavior).  If the memory addresses are the
same, that means init called twice for the same servlet, which is bad.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Bug ? Init is called twice in SingleThreadModel

2003-07-02 Thread Hal Lander
The init method of my servlet is called twice if my class implements the 
SingleThreadModel.
Full details are given below. If I remove "implements SingleThreadModel" 
init is called only once - as I would expect.

Is this a bug?
Any help would be appreciated.
Hal.



THE SOURCE CODE

import javax.servlet.http.HttpServlet;
import javax.servlet.SingleThreadModel;
public class x extends HttpServlet implements SingleThreadModel
//
{
public void init()
//
{
System.out.println("init called");
return;
}
}
URL USED TO INVOKE SERVLET
==
http://localhost:8080/examples/servlet/x


OUTPUT IN "START TOMCAT" WINDOW
===
Starting service Tomcat-Standalone
Apache Tomcat/4.0.4
Starting service Tomcat-Apache
Apache Tomcat/4.0.4
init called
init called
localhost_examples_log.2003-06-27.txt
=
2003-06-27 11:39:09 WebappLoader[/examples]: Deploying class repositories to 
work directory C:\Program Files\Apache Tomcat 
4.0\work\Standalone\localhost\examples
2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR 
/WEB-INF/lib/httpclient.jar to C:\Program Files\Apache Tomcat 
4.0\webapps\examples\WEB-INF\lib\httpclient.jar
2003-06-27 11:39:09 WebappLoader[/examples]: Deploy JAR 
/WEB-INF/lib/logging.jar to C:\Program Files\Apache Tomcat 
4.0\webapps\examples\WEB-INF\lib\logging.jar
2003-06-27 11:39:09 WebappLoader[/examples]: Reloading checks are enabled 
for this Context
2003-06-27 11:39:09 StandardManager[/examples]: Seeding random number 
generator class java.security.SecureRandom
2003-06-27 11:39:09 StandardManager[/examples]: Seeding of random number 
generator has been completed
2003-06-27 11:39:09 ContextConfig[/examples]: Added certificates -> request 
attribute Valve
2003-06-27 11:39:09 ContextConfig[/examples]: Configured an authenticator 
for method FORM
2003-06-27 11:39:09 ContextListener: contextInitialized()
2003-06-27 11:39:09 SessionListener: contextInitialized()
2003-06-27 11:39:09 ContextListener: 
attributeReplaced('org.apache.catalina.WELCOME_FILES', 
'[Ljava.lang.String;@1f6226')
2003-06-27 11:39:09 StandardWrapper[/examples:default]: Loading container 
servlet default
2003-06-27 11:39:09 default: init 2003-06-27 11:39:09 
StandardWrapper[/examples:invoker]: Loading container servlet invoker
2003-06-27 11:39:09 invoker: init 2003-06-27 11:39:09 jsp: init 2003-06-27 
11:39:45 org.apache.catalina.INVOKER.x: init
2003-06-27 11:39:45 org.apache.catalina.INVOKER.x: init
2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Servlet 
Mapped Filter, filterClass=filters.ExampleFilter]): 20 milliseconds
2003-06-27 11:39:45 InvokerFilter(ApplicationFilterConfig[name=Path Mapped 
Filter, filterClass=filters.ExampleFilter]): 20 milliseconds
2003-06-27 11:40:04 SessionListener: contextDestroyed() 2003-06-27 11:40:04 
ContextListener: contextDestroyed()
2003-06-27 11:40:04 org.apache.catalina.INVOKER.x: destroy 2003-06-27 
11:40:04 org.apache.catalina.INVOKER.x: destroy

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Using SingleThreadModel under tomcat

2003-01-23 Thread Shapira, Yoav
Howdy,
Other people have already explained how tomcat does things.  I just
wanted to chime in saying SingleThreadModel is potentially worse than
just a waste of time: it can mislead you into thinking your servlet and
all the code it touches is automatically thread safe.  It's not.

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Colquhoun, Adrian [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, January 23, 2003 6:00 AM
>To: 'Tomcat Users List'
>Subject: Using SingleThreadModel under tomcat
>
>
>
>Hi
>
>I have a stateless servlet application in which I am considering
>implementing SingleThreadModel. I note from the archives a number of
posts
>which suggest that implementing SingleThreadModel will impose a
performance
>overhead when running under tomcat. Could anyone provide me with a
>explanation of how this performance impact comes about and (in relative
>terms) the magnitude of this impact versus the potential impact of
using
>synchronisation blocks to ensure thread safe code ?
>
>Thanks
>
>Adrian
>
>
>===
>Information in this email and any attachments are confidential, and may
>not be copied or used by anyone other than the addressee, nor disclosed
>to any third party without our permission.  There is no intention to
>create any legally binding contract or other commitment through the use
>of this email.
>
>Experian Limited (registration number 653331).
>Registered office: Talbot House, Talbot Street, Nottingham NG1 5HF
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Using SingleThreadModel under tomcat

2003-01-23 Thread Erik Price


Colquhoun, Adrian wrote:


Hi

I have a stateless servlet application in which I am considering
implementing SingleThreadModel. I note from the archives a number of posts
which suggest that implementing SingleThreadModel will impose a performance
overhead when running under tomcat. Could anyone provide me with a
explanation of how this performance impact comes about and (in relative
terms) the magnitude of this impact versus the potential impact of using
synchronisation blocks to ensure thread safe code ? 

There is another perspective as to why implementing SingleThreadModel is 
a waste of time on this page -- scroll down to near the bottom where 
there is an  that says "Don't Use SingleThreadModel" (or search for 
that text on the page).

http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index1.html?page=4



Erik


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



RE: Using SingleThreadModel under tomcat

2003-01-23 Thread Daniel Brown
2. Tomcat maintains a pool of up to 20 (by default) instances of each
servlet that implements the SingleThreadModel.

If no instance is available when a new request comes in, the request waits
on an instance freeing up, so will be serviced when the queue empties, or
when the request gets lucky, and is randomly chosen by the scheduler as the
one to be notified.

> -Original Message-
> From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
> Sent: 23 January 2003 11:48
> To: [EMAIL PROTECTED]; Tomcat Users List
> Subject: RE: Using SingleThreadModel under tomcat
>
>
>   And tomcat implements option 1 or 2?
>
> On Thu, 2003-01-23 at 09:36, Daniel Brown wrote:

> > If, however, the servlet implements SingleThreadModel, then the
> container
> > has two choices:
> >
> > 1. serialise all requests through the single instance
> > 2. create a pool of servlet instances, and share out requests
> amongst the
> > pool, as each pool member becomes free


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Using SingleThreadModel under tomcat

2003-01-23 Thread Felipe Schnack
  And tomcat implements option 1 or 2?

On Thu, 2003-01-23 at 09:36, Daniel Brown wrote:
> Adrian,
> 
> Here's a starter:
> 
> Normally, the servlet container maintains only one instance of each servlet,
> (one instance per servlet per JVM is required by the servlet spec. in a
> non-distributed environment) and passes all requests received concurrently
> through the service method of that instance.
> 
> If, however, the servlet implements SingleThreadModel, then the container
> has two choices:
> 
> 1. serialise all requests through the single instance
> 2. create a pool of servlet instances, and share out requests amongst the
> pool, as each pool member becomes free
> 
> Option 1 has an obvious performance penalty, if your application ever has
> more than one concurrent request.
> 
> Option 2 requires more server resources for the extra objects created, more
> processing to manage the pool, and, as the number of concurrent requests
> increase, will end up either in poor performance, if the container limits
> the pool to a certain size, and forms a queue of new requests; or poor
> performance and then lack of service as the container runs out of memory.
> 
> Note also that SingleThreadModel doesn't buy you very much - although you no
> longer need to worry about synchronising access to instance variables, you
> still need to handle synchronisation of external resources, static
> variables, sessions, etc., as you can still have more than one request
> executing concurrently, just in different instances of the same servlet.
> 
> HTH,
> 
> Dan.
> 
> > I have a stateless servlet application in which I am considering
> > implementing SingleThreadModel. I note from the archives a number of posts
> > which suggest that implementing SingleThreadModel will impose a
> > performance
> > overhead when running under tomcat. Could anyone provide me with a
> > explanation of how this performance impact comes about and (in relative
> > terms) the magnitude of this impact versus the potential impact of using
> > synchronisation blocks to ensure thread safe code ?
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Using SingleThreadModel under tomcat

2003-01-23 Thread Daniel Brown
Adrian,

Here's a starter:

Normally, the servlet container maintains only one instance of each servlet,
(one instance per servlet per JVM is required by the servlet spec. in a
non-distributed environment) and passes all requests received concurrently
through the service method of that instance.

If, however, the servlet implements SingleThreadModel, then the container
has two choices:

1. serialise all requests through the single instance
2. create a pool of servlet instances, and share out requests amongst the
pool, as each pool member becomes free

Option 1 has an obvious performance penalty, if your application ever has
more than one concurrent request.

Option 2 requires more server resources for the extra objects created, more
processing to manage the pool, and, as the number of concurrent requests
increase, will end up either in poor performance, if the container limits
the pool to a certain size, and forms a queue of new requests; or poor
performance and then lack of service as the container runs out of memory.

Note also that SingleThreadModel doesn't buy you very much - although you no
longer need to worry about synchronising access to instance variables, you
still need to handle synchronisation of external resources, static
variables, sessions, etc., as you can still have more than one request
executing concurrently, just in different instances of the same servlet.

HTH,

Dan.

> I have a stateless servlet application in which I am considering
> implementing SingleThreadModel. I note from the archives a number of posts
> which suggest that implementing SingleThreadModel will impose a
> performance
> overhead when running under tomcat. Could anyone provide me with a
> explanation of how this performance impact comes about and (in relative
> terms) the magnitude of this impact versus the potential impact of using
> synchronisation blocks to ensure thread safe code ?


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Using SingleThreadModel under tomcat

2003-01-23 Thread Colquhoun, Adrian


Hi

I have a stateless servlet application in which I am considering
implementing SingleThreadModel. I note from the archives a number of posts
which suggest that implementing SingleThreadModel will impose a performance
overhead when running under tomcat. Could anyone provide me with a
explanation of how this performance impact comes about and (in relative
terms) the magnitude of this impact versus the potential impact of using
synchronisation blocks to ensure thread safe code ? 

Thanks

Adrian


===
Information in this email and any attachments are confidential, and may
not be copied or used by anyone other than the addressee, nor disclosed
to any third party without our permission.  There is no intention to
create any legally binding contract or other commitment through the use
of this email.

Experian Limited (registration number 653331).  
Registered office: Talbot House, Talbot Street, Nottingham NG1 5HF

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Q: SingleThreadModel and Tomcat

2002-12-11 Thread Felipe Schnack
  I totally agree, but sometimes you want a single instance of a servlet
anyway

On Tue, 2002-12-10 at 23:33, Craig R. McClanahan wrote:
> 
> 
> On Mon, 9 Dec 2002, David Boyer wrote:
> 
> > Date: Mon, 09 Dec 2002 12:19:12 -0600
> > From: David Boyer <[EMAIL PROTECTED]>
> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: Q: SingleThreadModel and Tomcat
> >
> > It seems like different servlet containers vary in how they approach access to 
>classes that implement SingleThreadModel. When multiple threads want to access the 
>class, some servlet containers will create multiple instances of the class while 
>others queue the threads for exclusive access to a single instance of the class.
> >
> > Which approach does Tomcat take?
> >
> 
> Until relatively recently, Tomcat did the latter approach. Current
> versions support a pool of instances.
> 
> However, in general, I would recommend against usting SingleThreadModel in
> your applications.  The sense of thread safety that you get is an illusion
> if you're also using sessions - it's very easy to triger multiple requests
> to the same session at the same time.  In addition, dealing with the pool
> of STM servlet instances is just wasted overhead that slows your app down.
> 
> Far better would be to learn how to write thread-safe servlets in the
> first place.  It's not that hard -- the principal thing to avoid is using
> instance variables (in your servlets) to represent state information for a
> particular request.
> 
> Craig
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303328


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Q: SingleThreadModel and Tomcat

2002-12-10 Thread Craig R. McClanahan


On Mon, 9 Dec 2002, David Boyer wrote:

> Date: Mon, 09 Dec 2002 12:19:12 -0600
> From: David Boyer <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Q: SingleThreadModel and Tomcat
>
> It seems like different servlet containers vary in how they approach access to 
>classes that implement SingleThreadModel. When multiple threads want to access the 
>class, some servlet containers will create multiple instances of the class while 
>others queue the threads for exclusive access to a single instance of the class.
>
> Which approach does Tomcat take?
>

Until relatively recently, Tomcat did the latter approach. Current
versions support a pool of instances.

However, in general, I would recommend against usting SingleThreadModel in
your applications.  The sense of thread safety that you get is an illusion
if you're also using sessions - it's very easy to triger multiple requests
to the same session at the same time.  In addition, dealing with the pool
of STM servlet instances is just wasted overhead that slows your app down.

Far better would be to learn how to write thread-safe servlets in the
first place.  It's not that hard -- the principal thing to avoid is using
instance variables (in your servlets) to represent state information for a
particular request.

Craig



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




servlet implementing SingleThreadModel

2002-12-09 Thread Patricio Vera S.
Hello,

I tried to understand the implementation of SingleThreadModel on
Jakarta-Tomcat servlet engine.

The idea is run one instance of the servlet with the "opcion" parameter
= SS so the servlet run in a cycle for ever and then call in a new window
the same servlet with the "opcion" parameter != SS, so I get the next
results :

1. In my tomcat 3.2.1 over Linux implementation I get timeout on the
second call of the servlet, even I configured tomcat with thread pool (i
attach part of the server.xml).

2. In my tomcat 4.1 over W2K implementation I get the correct answer on
the second call of the servlet.

So the question is :

a. Is there any problem with the tomcat 3.2.1 version over Linux and
threads?
b. How I can configure tomcat 3.2.1 for thread safe?

I appreciate any help or idea... thanks in advance.


serThread Code :

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class serThread extends HttpServlet implements SingleThreadModel {

 //Initialize global variables
  public void init(ServletConfig config) throws ServletException {
  super.init(config);
 }

 //Process the HTTP Get request
  public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
  //
  String sOpcion = "";
  try {
 sOpcion = request.getParameter("opcion");
} catch (Exception e) {
 e.printStackTrace();
  sOpcion = "No Option";
}
  response.setContentType("text/html");
  PrintWriter out = new PrintWriter (response.getOutputStream());

if (sOpcion == null || sOpcion.equals("") )
 sOpcion = "No Option";

if (sOpcion.equals("SS")) {
 while ( true )
  ;
}
  out.println("");
  out.println("serThread");
  out.println("");
out.println("Hello!!");
out.println("Opcion : " + sOpcion + "");
  out.println("");
  out.close();
 }

 //Get Servlet information
  public String getServletInfo() {
  return "serProcard.serThread Information";
 }
}

server.xml :









Saludos,
Patricio Vera S.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Q: SingleThreadModel and Tomcat

2002-12-09 Thread David Boyer
It seems like different servlet containers vary in how they approach access to classes 
that implement SingleThreadModel. When multiple threads want to access the class, some 
servlet containers will create multiple instances of the class while others queue the 
threads for exclusive access to a single instance of the class.

Which approach does Tomcat take?


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: SingleThreadModel under Tomcat 3.3.1 is not working???

2002-05-15 Thread Larry Isaacs

Sorry it missed getting into the documentation beyond the
readme-3.3.1, but Tomcat 3.3.1 now supports a SingleThreadModel
pooling, which is enabled by default.  Thus, this is normal
behavior.  If you wish to disable the pooling, modify the
server.xml to contain:



Cheers,
Larry

> -Original Message-
> From: Atnite [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, May 15, 2002 7:38 AM
> To: [EMAIL PROTECTED]
> Subject: SingleThreadModel under Tomcat 3.3.1 is not working???
> 
> 
> Hello there,
> I've got a question. I've made a servlet that is meant to be run using
> single thread model. It was made using JBuilder 5. When I run it under
> JBuilder's supplied Tomcat 3.2 hosting this servlet, it is 
> working exactly
> as expected - requests are queued and one is served at a 
> time. But, when I
> run the very same servlet under Tomcat 3.3.1, despite that 
> I've implemented
> SingleThreadModel in servlet and even made extra 
> synchronization, it still
> has no effect - requests are served all at the time of their arrival.
> The question is - is it a bug of Tomcat 3.3.1 or I miss 
> something (probably
> in Tomcat configuration files).
> Thanks
> 
> 
> 
> _
> 
> Do You Yahoo!?
> 
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




SingleThreadModel under Tomcat 3.3.1 is not working???

2002-05-15 Thread Atnite

Hello there,
I've got a question. I've made a servlet that is meant to be run using
single thread model. It was made using JBuilder 5. When I run it under
JBuilder's supplied Tomcat 3.2 hosting this servlet, it is working exactly
as expected - requests are queued and one is served at a time. But, when I
run the very same servlet under Tomcat 3.3.1, despite that I've implemented
SingleThreadModel in servlet and even made extra synchronization, it still
has no effect - requests are served all at the time of their arrival.
The question is - is it a bug of Tomcat 3.3.1 or I miss something (probably
in Tomcat configuration files).
Thanks


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Scott Shorter

> I guess I can deploy to somewhere besides webapps - that 
> should do it, huh?
> 
> I'll try that and let all know.

That did the trick.  Thanks for the pointers, Randy and Mark.
-
Scott


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Scott Shorter

> > 3.  Having the same context loaded multiple times.
> > This generally happens because the AutoContextLoader (or 
> > whatever its called) is still enabled and an explicit Context 
> > is also defined, making two contexts (and two instances of 
> > the servlets).
> 
> Maybe.  I do have a context explicitly defined (I need to, so 
> I can create an authentication realm for the user interface 
> portion of the application).  I will look into how to not 
> automatically load contexts and see if that helps.

Well after reading
tomcat-docs/config/host.html#Automatic%20Application%20Deployment I am
discouraged.  It says that WARs are automatically unpacked (which you
*can* turn off using unpackWARs=false in the Host tag) and that contexts
are automatically generated for all contents of webapps.  It doesn't say
how to turn that feature off.

I guess I can deploy to somewhere besides webapps - that should do it,
huh?

I'll try that and let all know.
-
Scott


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Scott Shorter

Randy,

Thanks for clarifying what you meant.

>   1.  Multiple  tags in web.xml

Nope.

>   2.  One or more  tag(s) in web.xml and using 
> /servlets/ to access your servlet

Nope.

>   3.  Having the same context loaded multiple times.  
> This generally happens because the AutoContextLoader (or 
> whatever its called) is still enabled and an explicit Context 
> is also defined, making two contexts (and two instances of 
> the servlets).

Maybe.  I do have a context explicitly defined (I need to, so I can
create an authentication realm for the user interface portion of the
application).  I will look into how to not automatically load contexts
and see if that helps.
-
Scott


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Wagoner, Mark

I afraid I have had the good fortune to not have this problem.  :-)

Short of what you have already done, I'm not sure where else to look.  My
understanding is Tomcat invokes init when it loads the servlet.  Is it
possible that the servlet is dieing for some reason and is actually being
re-loaded?

Just a wild guess.

-Original Message-
From: Scott Shorter [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 9:09 AM
To: 'Tomcat Users List'
Subject: RE: Getting multiple instances of my servlet, although it
doesn't implement SingleThreadModel


Mark,

This sounds kinda similar to what my servlet is for - the overall
application is a testing tool that sometimes acts as a client, sending
messages out, and sometimes as a server.  The servlet that's giving me
problems does two main things - it kicks off the tests in its init()
method (which it why it's important that it be called only once) and it
also receives incoming messages and dispatches them to the correct test
object.

The interesting/odd thing is that this problem occurs on only two of the
three machines on which the system runs.  I've pored over the
configurations of the three machines, and can't figure out what
difference could be causing this.  Can you suggest where I can look,
beyond the web.xml and server.xml files?

Thanks,
Scott

> -Original Message-
> From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, March 01, 2002 9:06 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> I don't think this is exactly true.  I have an app using the 
> mediator design pattern, in which there is only one servlet 
> handling all requests (all of my servlet mappings point to 
> the same servlet).  It in turn hands the requests off to 
> various classes and/or JSP pages for actual processing.  
> Within this servlet's init method is where I create my 
> connection pool, configure Log4j logging, etc.  I have never 
> seen any case of init being called more than once.
> 
> -Original Message-
> From: Randy Layman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 01, 2002 6:38 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> 
>   Basically, Tomcat will create a separate instance for 
> each unique URL that the servlet responses to.
> 
>   (Technically, every time you define the servlet in the 
> web.xml there is a separate instance, and another instance is 
> created when you use the ServletInvoker to invoke the servlet 
> by /servlet/className.)
> 
>   Randy
> 
> 
> > -Original Message-
> > From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 28, 2002 4:34 PM
> > To: 'Tomcat Users List'
> > Subject: Getting multiple instances of my servlet, although 
> it doesn't 
> > implement SingleThreadModel
> > 
> > 
> > All,
> > 
> > I have a servlet that loads on startup, per the 
>  tag 
> > in web.xml.  It does *not* implement SingleThreadModel.
> > 
> > Unfortunately, two instances start up every time Tomcat 
> starts - I can 
> > tell because I have a System.out.println call in init().  I 
> need for 
> > there to be only one instance.
> > 
> > What other settings could be causing multiple instances to happen?
> > 
> > Thanks in advance,
> > Scott
> > 
> > 
> > --
> > To unsubscribe:   
> <mailto:tomcat-user-> [EMAIL PROTECTED]>
> > For 
> additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To 
> unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Randy Layman


I guess what I said has led to some confusion.  I meant that each
 tag creates an instance.

Here are the possible reasons for getting multiple instances:
1.  Multiple  tags in web.xml
2.  One or more  tag(s) in web.xml and using /servlets/ to
access your servlet
3.  Having the same context loaded multiple times.  This generally
happens because the AutoContextLoader (or whatever its called) is still
enabled and an explicit Context is also defined, making two contexts (and
two instances of the servlets).

Randy


> -Original Message-
> From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 01, 2002 9:05 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, although it
> doesn't implement SingleThreadModel
> 
> 
> Randy,
> 
> The servlet is defined once in web.xml - one  tag, 
> that is.  In
> addition it is mapped to the root URL with a statement of the form:
> 
>   
> MessageDispatcherServlet
> /
>   
> 
> Are you saying the servlet mapping is responsible for the multiple
> instances?
> 
> I don't think that's the case, because I can comment out the 
> mapping and
> still get the same results.
> 
> Thanks, though.  I'll keep working at it.
> -
> Scott
> 
> > -Original Message-
> > From: Randy Layman [mailto:[EMAIL PROTECTED]] 
> > Sent: Friday, March 01, 2002 6:38 AM
> > To: 'Tomcat Users List'
> > Subject: RE: Getting multiple instances of my servlet, 
> > although it doesn't implement SingleThreadModel
> > 
> > 
> > 
> > Basically, Tomcat will create a separate instance for 
> > each unique URL that the servlet responses to.
> > 
> > (Technically, every time you define the servlet in the 
> > web.xml there is a separate instance, and another instance is 
> > created when you use the ServletInvoker to invoke the servlet 
> > by /servlet/className.)
> > 
> > Randy
> > 
> > 
> > > -Original Message-
> > > From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, February 28, 2002 4:34 PM
> > > To: 'Tomcat Users List'
> > > Subject: Getting multiple instances of my servlet, although 
> > it doesn't 
> > > implement SingleThreadModel
> > > 
> > > 
> > > All,
> > > 
> > > I have a servlet that loads on startup, per the 
> >  tag 
> > > in web.xml.  It does *not* implement SingleThreadModel.
> > > 
> > > Unfortunately, two instances start up every time Tomcat 
> > starts - I can 
> > > tell because I have a System.out.println call in init().  I 
> > need for 
> > > there to be only one instance.
> > > 
> > > What other settings could be causing multiple instances to happen?
> > > 
> > > Thanks in advance,
> > > Scott
> > > 
> > > 
> > > --
> > > To unsubscribe:   
> > <mailto:tomcat-user-> [EMAIL PROTECTED]>
> > > For 
> > additional commands: 
> > <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list: 
> > <mailto:[EMAIL PROTECTED]>
> > > 
> > 
> > --
> > To 
> > unsubscribe:   <mailto:[EMAIL PROTECTED]>
> > For additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Scott Shorter

Mark,

This sounds kinda similar to what my servlet is for - the overall
application is a testing tool that sometimes acts as a client, sending
messages out, and sometimes as a server.  The servlet that's giving me
problems does two main things - it kicks off the tests in its init()
method (which it why it's important that it be called only once) and it
also receives incoming messages and dispatches them to the correct test
object.

The interesting/odd thing is that this problem occurs on only two of the
three machines on which the system runs.  I've pored over the
configurations of the three machines, and can't figure out what
difference could be causing this.  Can you suggest where I can look,
beyond the web.xml and server.xml files?

Thanks,
Scott

> -Original Message-
> From: Wagoner, Mark [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, March 01, 2002 9:06 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> I don't think this is exactly true.  I have an app using the 
> mediator design pattern, in which there is only one servlet 
> handling all requests (all of my servlet mappings point to 
> the same servlet).  It in turn hands the requests off to 
> various classes and/or JSP pages for actual processing.  
> Within this servlet's init method is where I create my 
> connection pool, configure Log4j logging, etc.  I have never 
> seen any case of init being called more than once.
> 
> -Original Message-
> From: Randy Layman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 01, 2002 6:38 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> 
>   Basically, Tomcat will create a separate instance for 
> each unique URL that the servlet responses to.
> 
>   (Technically, every time you define the servlet in the 
> web.xml there is a separate instance, and another instance is 
> created when you use the ServletInvoker to invoke the servlet 
> by /servlet/className.)
> 
>   Randy
> 
> 
> > -Original Message-
> > From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 28, 2002 4:34 PM
> > To: 'Tomcat Users List'
> > Subject: Getting multiple instances of my servlet, although 
> it doesn't 
> > implement SingleThreadModel
> > 
> > 
> > All,
> > 
> > I have a servlet that loads on startup, per the 
>  tag 
> > in web.xml.  It does *not* implement SingleThreadModel.
> > 
> > Unfortunately, two instances start up every time Tomcat 
> starts - I can 
> > tell because I have a System.out.println call in init().  I 
> need for 
> > there to be only one instance.
> > 
> > What other settings could be causing multiple instances to happen?
> > 
> > Thanks in advance,
> > Scott
> > 
> > 
> > --
> > To unsubscribe:   
> <mailto:tomcat-user-> [EMAIL PROTECTED]>
> > For 
> additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To 
> unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Scott Shorter

Randy,

The servlet is defined once in web.xml - one  tag, that is.  In
addition it is mapped to the root URL with a statement of the form:

  
MessageDispatcherServlet
/
  

Are you saying the servlet mapping is responsible for the multiple
instances?

I don't think that's the case, because I can comment out the mapping and
still get the same results.

Thanks, though.  I'll keep working at it.
-
Scott

> -Original Message-
> From: Randy Layman [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, March 01, 2002 6:38 AM
> To: 'Tomcat Users List'
> Subject: RE: Getting multiple instances of my servlet, 
> although it doesn't implement SingleThreadModel
> 
> 
> 
>   Basically, Tomcat will create a separate instance for 
> each unique URL that the servlet responses to.
> 
>   (Technically, every time you define the servlet in the 
> web.xml there is a separate instance, and another instance is 
> created when you use the ServletInvoker to invoke the servlet 
> by /servlet/className.)
> 
>   Randy
> 
> 
> > -Original Message-
> > From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 28, 2002 4:34 PM
> > To: 'Tomcat Users List'
> > Subject: Getting multiple instances of my servlet, although 
> it doesn't 
> > implement SingleThreadModel
> > 
> > 
> > All,
> > 
> > I have a servlet that loads on startup, per the 
>  tag 
> > in web.xml.  It does *not* implement SingleThreadModel.
> > 
> > Unfortunately, two instances start up every time Tomcat 
> starts - I can 
> > tell because I have a System.out.println call in init().  I 
> need for 
> > there to be only one instance.
> > 
> > What other settings could be causing multiple instances to happen?
> > 
> > Thanks in advance,
> > Scott
> > 
> > 
> > --
> > To unsubscribe:   
> <mailto:tomcat-user-> [EMAIL PROTECTED]>
> > For 
> additional commands: 
> <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: 
> <mailto:[EMAIL PROTECTED]>
> > 
> 
> --
> To 
> unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Wagoner, Mark

I don't think this is exactly true.  I have an app using the mediator design
pattern, in which there is only one servlet handling all requests (all of my
servlet mappings point to the same servlet).  It in turn hands the requests
off to various classes and/or JSP pages for actual processing.  Within this
servlet's init method is where I create my connection pool, configure Log4j
logging, etc.  I have never seen any case of init being called more than
once.

-Original Message-
From: Randy Layman [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 6:38 AM
To: 'Tomcat Users List'
Subject: RE: Getting multiple instances of my servlet, although it
doesn't implement SingleThreadModel



Basically, Tomcat will create a separate instance for each unique
URL that the servlet responses to.

(Technically, every time you define the servlet in the web.xml there
is a separate instance, and another instance is created when you use the
ServletInvoker to invoke the servlet by /servlet/className.)

Randy


> -Original Message-
> From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:34 PM
> To: 'Tomcat Users List'
> Subject: Getting multiple instances of my servlet, although it doesn't
> implement SingleThreadModel
> 
> 
> All,
> 
> I have a servlet that loads on startup, per the  tag
> in web.xml.  It does *not* implement SingleThreadModel.
> 
> Unfortunately, two instances start up every time Tomcat starts - I can
> tell because I have a System.out.println call in init().  I need for
> there to be only one instance.
> 
> What other settings could be causing multiple instances to happen?
> 
> Thanks in advance,
> Scott
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-03-01 Thread Randy Layman


Basically, Tomcat will create a separate instance for each unique
URL that the servlet responses to.

(Technically, every time you define the servlet in the web.xml there
is a separate instance, and another instance is created when you use the
ServletInvoker to invoke the servlet by /servlet/className.)

Randy


> -Original Message-
> From: Scott Shorter [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 28, 2002 4:34 PM
> To: 'Tomcat Users List'
> Subject: Getting multiple instances of my servlet, although it doesn't
> implement SingleThreadModel
> 
> 
> All,
> 
> I have a servlet that loads on startup, per the  tag
> in web.xml.  It does *not* implement SingleThreadModel.
> 
> Unfortunately, two instances start up every time Tomcat starts - I can
> tell because I have a System.out.println call in init().  I need for
> there to be only one instance.
> 
> What other settings could be causing multiple instances to happen?
> 
> Thanks in advance,
> Scott
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Getting multiple instances of my servlet, although it doesn't implement SingleThreadModel

2002-02-28 Thread Scott Shorter

All,

I have a servlet that loads on startup, per the  tag
in web.xml.  It does *not* implement SingleThreadModel.

Unfortunately, two instances start up every time Tomcat starts - I can
tell because I have a System.out.println call in init().  I need for
there to be only one instance.

What other settings could be causing multiple instances to happen?

Thanks in advance,
Scott


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: SingleThreadModel only giving 1 thread

2001-10-31 Thread Edward Ivanovic

Hi Troy,
Sorry I didn't get around to replying earlier.
I'm stopped using Tomcat and replaced it with the Jetty server from
http://www.mortbay.org/

It addresses the issues/problems with the SingleThreadModel, cookies, and
host name resolution - all of which I was having problems with when using
Tomcat.
It's also open source and licensing is very similar to Tomcat's.

As for the SingleThreadModel issues, without wasting too much time on a
topic that I'm sure has already been discussed to death here I'll just say
that pooling SingleThreadModel servlets becomes very convenient when dealing
with certain 3rd-party products that may be single threaded and don't have
built-in pooling for the resources.  So rather than writing a pooling
container and wrappers around these classes is becomes much easier to
implement the SingleThreadModel and have the server pool those.  Transaction
management and variable sharing also becomes easier.  I'm obviously talking
about a transaction server rather than a HTML/JSP server.
Resources can still be shared using static methods/variables and focus can
be given there to synchronize appropriately.

This being a technical issue rather than one of opinion, I'd be very
interested in reading any publications/papers on why the SingleThreadModel
is bad.  If it's so bad then I must be missing something.  I'd like to know
the reasons so that I can change my code to stop using this Java feature.

I'm sure the people at Sun, IBM, bea (WebLogic), Oracle, and many others
would also be interested since they've all decided to implement the
SingleThreadModel pooling.


-Original Message-
From: Richard Troy [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 19, 2001 2:50 PM
To: [EMAIL PROTECTED]
Subject: Re: SingleThreadModel only giving 1 thread




> > I'm using Tomcat 4.0 and have a servlet that implements
SingleThreadModel.
> > In every other app server I've tried (WebSphere & WebLogic) multiple
> > instances of this servlet are created and handle concurrent requests.
> >
> > However, in Tomcat it only creates one instance of the servlet and other
> > users must wait to be processed. i.e. only 1 user at a time is served.
> >
>
> SingleThreadModel is a horrible API because it totally misleads people
> about thread safety.  Therefore, I don't believe in encouraging people to
> use it by doing any more than the spec requires -- although anyone who
> wants to is welcome to submit a patch to Tomcat to make is support
> instance pooling for STM servlets.
>

Hmmm... As a long-time operating systems programmer, I really get why you
might want a single-threaded section of code. From what I read of Tomcat's
behavior with single-threading, it appears to be 'a' correct
implementation, not 'the' correct implementation. To gage what would be
the 'better' solution depends on what you intend to do with it. Generally
speaking, the two primary uses of single-threading are to help ensure that
a given data-structure (or single datum) isn't inappropriately
concurrently accessed by another thread - thereby causing inappropriate
behavior- or to enforce a particular timing coordination. Traditionally
single-threaded sections are implemented with a signaling mechanism and
strategies varry - take your pick: MUTEX, semaphore, flag, lock, (you
could even add inturrupts to this list - each of these with varying
enforcement) so that only one execution thread can munge through a
"critical section" at a time.

Using single-threading for enforcement of timing in the context of web
services, the Tomcat implementation is the only one that makes sense to
me, with exaclty (at most) one thread running that code at one time.
Creating duplicate instances of equally-empowered "single-threaded"
threads, as someone reported, doesn't appear to be a mechanism able to
enforce timing in a way that I can see as useful. It must also be realized
that the Tomcat implementation is limited to each Tomcat server - serve
your data from a cluster and you see the limited scope I'm talking about.
(Database access anyone?)

Considering methodologies to avoid concurrent update of data, 'scope'
really matters. In this context, the broadest scope I can easily imagine
(as a practical matter) of sensitive application data is that held in a
database. Traditionally, a database engine itself is your enforcement
engine, with a begin-transaction starting things off and a commit or
abort-transaction ending them. The DBMS will enforce one-at-a-time access
rules to ensure your data remains consistent. But, that presumes real
context for user interaction. One of the reasons the web model sucks as an
application deployment domain is that you have a hard time maintaining
context. Instead, the web is said to be "stateless&quo

RE: SingleThreadModel only giving 1 thread

2001-10-19 Thread Richard Troy


> That's incredibly frustrating as there are very valid cases where you need
> to use the SingleThread model and still support more than 1 user.

...After reading my other post on this subject, please reply. If my other
post didn't nail it, I want to know. I may have overlooked something, and
I'd really like to know if I did.

RT

-- 
Richard Troy, Chief Scientist
Science Tools Corporation
[EMAIL PROTECTED], 510-567-9957, http://ScienceTools.com/












Re: SingleThreadModel only giving 1 thread

2001-10-19 Thread Richard Troy



> > I'm using Tomcat 4.0 and have a servlet that implements SingleThreadModel.
> > In every other app server I've tried (WebSphere & WebLogic) multiple
> > instances of this servlet are created and handle concurrent requests.
> >
> > However, in Tomcat it only creates one instance of the servlet and other
> > users must wait to be processed. i.e. only 1 user at a time is served.
> >
>
> SingleThreadModel is a horrible API because it totally misleads people
> about thread safety.  Therefore, I don't believe in encouraging people to
> use it by doing any more than the spec requires -- although anyone who
> wants to is welcome to submit a patch to Tomcat to make is support
> instance pooling for STM servlets.
>

Hmmm... As a long-time operating systems programmer, I really get why you
might want a single-threaded section of code. From what I read of Tomcat's
behavior with single-threading, it appears to be 'a' correct
implementation, not 'the' correct implementation. To gage what would be
the 'better' solution depends on what you intend to do with it. Generally
speaking, the two primary uses of single-threading are to help ensure that
a given data-structure (or single datum) isn't inappropriately
concurrently accessed by another thread - thereby causing inappropriate
behavior- or to enforce a particular timing coordination. Traditionally
single-threaded sections are implemented with a signaling mechanism and
strategies varry - take your pick: MUTEX, semaphore, flag, lock, (you
could even add inturrupts to this list - each of these with varying
enforcement) so that only one execution thread can munge through a
"critical section" at a time.

Using single-threading for enforcement of timing in the context of web
services, the Tomcat implementation is the only one that makes sense to
me, with exaclty (at most) one thread running that code at one time.
Creating duplicate instances of equally-empowered "single-threaded"
threads, as someone reported, doesn't appear to be a mechanism able to
enforce timing in a way that I can see as useful. It must also be realized
that the Tomcat implementation is limited to each Tomcat server - serve
your data from a cluster and you see the limited scope I'm talking about.
(Database access anyone?)

Considering methodologies to avoid concurrent update of data, 'scope'
really matters. In this context, the broadest scope I can easily imagine
(as a practical matter) of sensitive application data is that held in a
database. Traditionally, a database engine itself is your enforcement
engine, with a begin-transaction starting things off and a commit or
abort-transaction ending them. The DBMS will enforce one-at-a-time access
rules to ensure your data remains consistent. But, that presumes real
context for user interaction. One of the reasons the web model sucks as an
application deployment domain is that you have a hard time maintaining
context. Instead, the web is said to be "stateless" - which roughly
equates to some flavor of "context challenged." (Look at all the bullshit
people go through with the cookie kludge.) Much is to be said to the
benefit of the stateless model, but it means that each web page hit and
its transactions must be absolutely semantically complete. And that,
generally, means a real headache for applicaton developers. ...Of course,
good application design, even within the context of a traditional
application environment, should also be as concerned about short,
semantically complete transactions much as reasonably possible because of
concurrency and locking concerns.  ...But I digress...

What I'm really saying is that for web-based applications, because
everything is essentially a one-shot-deal, there isn't any clear utility
to single-threading database access. (Particular traditional, single-node
or node-coordinated, non-web applications excepted.)  The application
_has_ to play whatever context games we read about on this list where
developers consider session_ids and so forth. And be ready for that action
to be the end of it. That leaves the scope of Java variables between
servlets/JSPs as the only remaining reasonable concern for a
single-threading paradigm.

Regarding using single-threading to protecting in memory data, it's only
"publicly" scoped data that matters. If some particular concurrent threads
can't read or write the sensitive data, it's no issue, so variable scoping
rules help determine utility. Unfortunately, I'm just dipping my toes in
this particular ocean. I don't yet have first hand experience with the
scope of Java variables between servlets and applications. And, I'd love
to hear from some of you: What are the relative scopes of variables
defined within this Servlet/JSP world? Do "realms" have somet

Re: SingleThreadModel only giving 1 thread

2001-10-19 Thread Remy Maucherat

> Edward Ivanovic at [EMAIL PROTECTED] wrote:
>
> > That's incredibly frustrating as there are very valid cases where you
need
> > to use the SingleThread model and still support more than 1 user.  The
> > SingleThreadModel is a necessary API - I don't think nothing horrible
about
> > it.  As for thread safety, that's something programmers need to learn.
> >
> > But anyway, thanks for the response. At least now I can stop wasting
time
> > looking through the documentation for the 50th time.  I'll also look at
the
> > archives.
> >
> > Is there another free/cheap app server out there that supports
> > SingleThreadModel with multiple servlet instances?
>
>
> You're more than welcome to use any of the other servlet containers
> supporting SingleThreadModel

I wouldn't be against adding some quality instance pooling code to the
StandardWrapper, but that would have to be contributed (ie, I'm not going to
do it, since I don't think it's useful, but if somebody does it for us, no
problem :)).

> (at the same time I'll lobby for its removal in
> the next Servlet specification)

I think the best you can hope for is "deprecated".

Remy




Re: SingleThreadModel only giving 1 thread

2001-10-19 Thread Pier Fumagalli

Edward Ivanovic at [EMAIL PROTECTED] wrote:

> That's incredibly frustrating as there are very valid cases where you need
> to use the SingleThread model and still support more than 1 user.  The
> SingleThreadModel is a necessary API - I don't think nothing horrible about
> it.  As for thread safety, that's something programmers need to learn.
> 
> But anyway, thanks for the response. At least now I can stop wasting time
> looking through the documentation for the 50th time.  I'll also look at the
> archives.
> 
> Is there another free/cheap app server out there that supports
> SingleThreadModel with multiple servlet instances?


You're more than welcome to use any of the other servlet containers
supporting SingleThreadModel (at the same time I'll lobby for its removal in
the next Servlet specification)

Pier




RE: SingleThreadModel only giving 1 thread

2001-10-19 Thread Edward Ivanovic

That's incredibly frustrating as there are very valid cases where you need
to use the SingleThread model and still support more than 1 user.  The
SingleThreadModel is a necessary API - I don't think nothing horrible about
it.  As for thread safety, that's something programmers need to learn.

But anyway, thanks for the response. At least now I can stop wasting time
looking through the documentation for the 50th time.  I'll also look at the
archives.

Is there another free/cheap app server out there that supports
SingleThreadModel with multiple servlet instances?

-Original Message-
From: craigmcc@localhost [mailto:craigmcc@localhost]On Behalf Of Craig
R. McClanahan
Sent: Friday, October 19, 2001 6:16 PM
To: [EMAIL PROTECTED]
Subject: Re: SingleThreadModel only giving 1 thread


On Fri, 19 Oct 2001, Edward Ivanovic wrote:

> Date: Fri, 19 Oct 2001 17:31:03 -0400
> From: Edward Ivanovic <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: SingleThreadModel only giving 1 thread
>
> I'm using Tomcat 4.0 and have a servlet that implements SingleThreadModel.
> In every other app server I've tried (WebSphere & WebLogic) multiple
> instances of this servlet are created and handle concurrent requests.
>
> However, in Tomcat it only creates one instance of the servlet and other
> users must wait to be processed. i.e. only 1 user at a time is served.
>
> I know that, strictly speaking, this does satisfy the Servlet spec, but
I'm
> suprised that Tomcat 4.0 would have chosen to handle SingleTheadModel in
> this way - or is there a configuration option that I'm not setting
> somewhere?
>

No, you are not missing anything.

SingleThreadModel is a horrible API because it totally misleads people
about thread safety.  Therefore, I don't believe in encouraging people to
use it by doing any more than the spec requires -- although anyone who
wants to is welcome to submit a patch to Tomcat to make is support
instance pooling for STM servlets.

This has been discussed a few bazillion times before on this list, if you
want to check the archives.

Craig McClanahan




Re: SingleThreadModel only giving 1 thread

2001-10-19 Thread Pae Choi

Craig,

What does the "bazillion" mean? Would you explain in number? :-)

Pae


>
>
>On Fri, 19 Oct 2001, Edward Ivanovic wrote:
>
>> Date: Fri, 19 Oct 2001 17:31:03 -0400
>> From: Edward Ivanovic <[EMAIL PROTECTED]>
>> Reply-To: [EMAIL PROTECTED]
>> To: [EMAIL PROTECTED]
>> Subject: SingleThreadModel only giving 1 thread
>>
>> I'm using Tomcat 4.0 and have a servlet that implements
SingleThreadModel.
>> In every other app server I've tried (WebSphere & WebLogic) multiple
>> instances of this servlet are created and handle concurrent requests.
>>
>> However, in Tomcat it only creates one instance of the servlet and other
>> users must wait to be processed. i.e. only 1 user at a time is served.
>>
>> I know that, strictly speaking, this does satisfy the Servlet spec, but
I'm
>> suprised that Tomcat 4.0 would have chosen to handle SingleTheadModel in
>> this way - or is there a configuration option that I'm not setting
>> somewhere?
>>
>
>No, you are not missing anything.
>
>SingleThreadModel is a horrible API because it totally misleads people
>about thread safety.  Therefore, I don't believe in encouraging people to
>use it by doing any more than the spec requires -- although anyone who
>wants to is welcome to submit a patch to Tomcat to make is support
>instance pooling for STM servlets.
>
>This has been discussed a few bazillion times before on this list, if you
>want to check the archives.
>
>Craig McClanahan
>




Re: SingleThreadModel only giving 1 thread

2001-10-19 Thread Craig R. McClanahan



On Fri, 19 Oct 2001, Edward Ivanovic wrote:

> Date: Fri, 19 Oct 2001 17:31:03 -0400
> From: Edward Ivanovic <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: SingleThreadModel only giving 1 thread
>
> I'm using Tomcat 4.0 and have a servlet that implements SingleThreadModel.
> In every other app server I've tried (WebSphere & WebLogic) multiple
> instances of this servlet are created and handle concurrent requests.
>
> However, in Tomcat it only creates one instance of the servlet and other
> users must wait to be processed. i.e. only 1 user at a time is served.
>
> I know that, strictly speaking, this does satisfy the Servlet spec, but I'm
> suprised that Tomcat 4.0 would have chosen to handle SingleTheadModel in
> this way - or is there a configuration option that I'm not setting
> somewhere?
>

No, you are not missing anything.

SingleThreadModel is a horrible API because it totally misleads people
about thread safety.  Therefore, I don't believe in encouraging people to
use it by doing any more than the spec requires -- although anyone who
wants to is welcome to submit a patch to Tomcat to make is support
instance pooling for STM servlets.

This has been discussed a few bazillion times before on this list, if you
want to check the archives.

Craig McClanahan




SingleThreadModel only giving 1 thread

2001-10-19 Thread Edward Ivanovic

I'm using Tomcat 4.0 and have a servlet that implements SingleThreadModel.
In every other app server I've tried (WebSphere & WebLogic) multiple
instances of this servlet are created and handle concurrent requests.

However, in Tomcat it only creates one instance of the servlet and other
users must wait to be processed. i.e. only 1 user at a time is served.

I know that, strictly speaking, this does satisfy the Servlet spec, but I'm
suprised that Tomcat 4.0 would have chosen to handle SingleTheadModel in
this way - or is there a configuration option that I'm not setting
somewhere?

to re-word:
When I start my servlet I would expect to see somthing like this pronted by
my servlet's init() method:

Servlet instance #1 started
Servlet instance #2 started
Servlet instance #3 started
Servlet instance #4 started
Servlet instance #5 started

And it would go up to handle multiple concurrent requests as requied -
maintaining its own servlet pool.

Instead, I currently only see:
Servlet instance #1 started

And that's it.
How do I change this?
As always, thanks for any help.




Re: SingleThreadModel

2001-04-23 Thread Milt Epstein

On Mon, 23 Apr 2001, Thomas Roeblitz wrote:

> Hi,
>
> I'm wondering how Tomcat (Versions 3.1 and 3.2) implements the
> SingleThreadModel. I was observing (v3.1) the case that parallel
> requests were executed concurrently for the very beginning, but
> later not. This behavior has been reported by some other people.
>
> Regarding version 3.2.1 I found a comment that the implementation
> uses a synchronized service-method.
>
> Does anybody know something about the actual implementation? How
> about further releases, is there a plan to provide one servlet
> instance per thread which executes a SingleThreadModel-object?
>
> Are there other Servlet-Containers which implements it in the
> way that every thread gets its own servlet instance?
>
> Thanks for your help. Any comment would be helpful

I believe some/most servlet containers do implement a pool of servlet
instances when a servlet implements SingleThreadModel.  But I don't
know about Tomcat.

But since you say "any comment" :-): DON'T USE SingleThreadModel!
There has been a lot of discussion of SingleThreadModel on Sun's
servlet-interest list, and the strong consensus is that it's bad to
use it -- it's misleading, because it doesn't really eliminate all
threading-/concurrency-related problems, and it causes a performance
hit.  The best thing is to just bite the bullet, learn what you need
to know about threading/concurrency, design your system to eliminate
threading/concurrency problems as much as possible, and when
unavoidable, use synchronize on the smallest block possible.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]




SingleThreadModel

2001-04-23 Thread Thomas Roeblitz

Hi,

I'm wondering how Tomcat (Versions 3.1 and 3.2) implements the
SingleThreadModel. I was observing (v3.1) the case that parallel
requests were executed concurrently for the very beginning, but
later not. This behavior has been reported by some other people.

Regarding version 3.2.1 I found a comment that the implementation
uses a synchronized service-method.

Does anybody know something about the actual implementation? How
about further releases, is there a plan to provide one servlet
instance per thread which executes a SingleThreadModel-object?

Are there other Servlet-Containers which implements it in the
way that every thread gets its own servlet instance?

Thanks for your help. Any comment would be helpful

Thomas




RE: Servlet -- SingleThreadModel

2001-04-18 Thread Wasniewski Arkadiusz

You can't use space! Try wrapper.java_home=C:\Progra~1\jdk1.3.0_02

Arek

> -Original Message-
> From: Colin Shreffler [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 13, 2001 8:02 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Servlet -- SingleThreadModel
> 
> 
> In trying to install TomCat as an NT service, I get the 
> following error in
> the jvm.stderr file when trying to start the NT service:
> 
> java.lang.NoClassDefFoundError: Files\jdk1/3/0_02\bin\java/exe
> Exception in thread "main" java.lang.NoClassDefFoundError:
> Files\jdk1/3/0_02\bin\java/exe
> Exception in thread "main" 
> 
> In the wrapper.properties file I have the following entry for 
> the java_home
> directory:
> wrapper.java_home=C:\Program Files\jdk1.3.0_02
> 
> Any ideas why this is failing?
> 
> Thanks,
> CShreffler
> 



RE: Servlet -- SingleThreadModel

2001-04-13 Thread Randy Layman


You can't install Tomcat as a service and use either TOMCAT_HOME or
JAVA_HOME with any spaces in it.  You need to either use the non-spaced
version of the name (i.e. Progra~1 for Program Files).

Randy

> -Original Message-
> From: Colin Shreffler [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 13, 2001 2:02 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Servlet -- SingleThreadModel
> 
> 
> In trying to install TomCat as an NT service, I get the 
> following error in
> the jvm.stderr file when trying to start the NT service:
> 
> java.lang.NoClassDefFoundError: Files\jdk1/3/0_02\bin\java/exe
> Exception in thread "main" java.lang.NoClassDefFoundError:
> Files\jdk1/3/0_02\bin\java/exe
> Exception in thread "main" 
> 
> In the wrapper.properties file I have the following entry for 
> the java_home
> directory:
> wrapper.java_home=C:\Program Files\jdk1.3.0_02
> 
> Any ideas why this is failing?
> 
> Thanks,
> CShreffler
> 



RE: Servlet -- SingleThreadModel

2001-04-13 Thread Colin Shreffler

In trying to install TomCat as an NT service, I get the following error in
the jvm.stderr file when trying to start the NT service:

java.lang.NoClassDefFoundError: Files\jdk1/3/0_02\bin\java/exe
Exception in thread "main" java.lang.NoClassDefFoundError:
Files\jdk1/3/0_02\bin\java/exe
Exception in thread "main" 

In the wrapper.properties file I have the following entry for the java_home
directory:
wrapper.java_home=C:\Program Files\jdk1.3.0_02

Any ideas why this is failing?

Thanks,
CShreffler




Re: Servlet -- SingleThreadModel

2001-04-13 Thread Tim O'Neil

At 12:42 PM 4/13/2001 -0500, you wrote:
>You can't really avoid dealing with concurrency issues in Java.  The
>best thing to do is to just bite the bullet, learn what you need to
>about concurrency, analyze your code, and make it handle it as
>best/easily as possible.  Avoid concurrency issues as much as
>possible, and when unavoidable, limit it to the smallest block
>possible and synchronize it.

Besides, concurrency in Java is not that bad.
Think about if you had to do this in C. Sun.com
is full of useful little thread action examples.
Do some research.




Re: Servlet -- SingleThreadModel

2001-04-13 Thread Milt Epstein

On Thu, 12 Apr 2001, eric leung wrote:

> I have a servlet implements the SingleThreadModel Interface. But
> this servlet has problem handle more than 1 request at a time.
>
> Since I have 1 person on host1 upload a big file ( > 20MB ) to the
> servlet.  When the 2nd person on host2 send a request to that
> servlet. The servlet will not response.
>
> Any one had the same problem using SingleThreadModel?  I am using
> apache 1.3.17 + tomcat 3.2.1.  thanks.
>
> P.S. I use SingleThreadModel beause i don't want to worry about
> syncronization of threads, I have Connection as instance variable:
[ ... ]

As has been posted, using SingleThreadModel is a bad idea.  There has
been a lot of discussion of it on Sun's servlet-interest list.  For
one thing, it does not allow you to not have to worry about threading
issues.  In this way, it is quite misleading.  It only really protects
you from certain kinds of threading issues, it is far from a cure-all.
And it has perforamnce implications, as you've seen.

You can't really avoid dealing with concurrency issues in Java.  The
best thing to do is to just bite the bullet, learn what you need to
about concurrency, analyze your code, and make it handle it as
best/easily as possible.  Avoid concurrency issues as much as
possible, and when unavoidable, limit it to the smallest block
possible and synchronize it.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]




Re: Servlet -- SingleThreadModel

2001-04-13 Thread Bo Xu

eric leung wrote:

> I have a servlet implements the SingleThreadModel
> Interface. But this servlet has problem handle more
> than 1 request at a time.
>
> Since I have 1 person on host1 upload a big file ( >
> 20MB ) to the servlet.  When the 2nd person on host2
> send a request to that servlet. The servlet will not
> response.
>
> Any one had the same problem using SingleThreadModel?
> I am using apache 1.3.17 + tomcat 3.2.1.
> thanks.
>
> P.S. I use SingleThreadModel beause i don't want to
> worry about syncronization of threads, I have
> Connection as instance variable:
>
> public class admin extends HttpServlet implements
> SingleThreadModel{
>   private PrintWriter out;
>   private OracleConnectionCacheImpl pool;
>   private Connection conn;
>   private Statement stmt;
>
>   ..etc...
> [...]

Hi :-)  from several emails in Servlet-List and this List, perhaps
it is better Not to use the following:
 - SingleThreadModel
 - public synchronized void service/doGet/doPost(...){...}

   (the above two are simialr)


*0  because in fact, the above 2 all use "this(instance) of MyServlet"
  to lock the code, But if:
 - we have more than one servlet-defination in WEB-INF/web.xml,
   now in fact we can not be sure about the "synchronized"
- if  the Servlet container supports "instance pool" for
SingleThreadModel,
  we also can not be sure about the "synchronized".
- if  the Servlet container Doesn't support "instance pool" for
SingleThreadModel,
   now perhaps the performence is not good if we use SingleThreadModel

*1  so I guess the shortcoming of the above 2 are:
- lock All code in service/doGet/doPost, in fact, perhaps we don't need
   to lock all of them
- in some cases, even if MyServlet implememts SingleThreadModel, we
  still can not be sure about "synchronized"(discussed in *0)

*2  so I suggest: perhaps it is better to use a "locker" to "lock and
only-lock" the
  code segment which must to be locked -> we don't need to lock all
the code,
  so now I need a locker: for example, we can use the following as a
locker:
  - a instance field or a static field in MyServlet:
 %private (static) byte[] locker=new byte[0];
 %private (static) Object  locker=new Object();
  - "this"(the instance object of MyServlet)
  - "this.getClass()"(the Class object of MyServlet in webapp
classloader,
 with TOMCAT, and if omitting the auto-reloading, it is Only-One)
  - ServletContext, with TC, it is Only-One within webapp.
  - MyHelper class
 % its instance(SingleTon or Non-SingleTon)
 % its Class object
 % its instance/static field


*3 the following are good emails :-)

*** email0 
See intermixed.

Bo Xu wrote:

> Gokul Singh wrote:
>
> > - Original Message -
> > From: "Bo Xu" <[EMAIL PROTECTED]>
> >
> > >   *  SingleThreadModel is non_multi-thread: so it is thread-safty
but it
> > is not
> > >multi-thread-safty.  But we also can think it is the safest
way of
> > >   multi-thread-safty :-)
> >
> > Single thread model is thread safe for the member variables of a
class, but
> > as the container *may* instantiate more than one instance, it is not
thread
> > safe for static variables, if any. Another fallback of this is if
you are
> > using a non static member variable, each instance will have it's own
copy
> > which may cause some problems e.g. if you used it to keep count of
the
> > number of hits.
> >
> >  >*  I guess if we use SingleThreadModel, the Servlet container
> >  >will have to work *harder*, and the efficacy is
lower(because
> >  >now for a Servelt class which implements
SingleThreadModel,
> >  >at any time, only zero/one client can access it ). and
from
> > several
> >  >emails, it is not good to use SingleThreadModel in a *real

> >  >system*-> it is for testing(?) or other purpose.
> >
> > In a real environment, there can be N number of requests being
processed
> > simultaneously by a servlet (each being a seperate thread). But if
you use
> > SingleThreadModel, you limit the number of simultaneous request
being
> > processed to the number of instances created by the container, which
can
> > even be 1 !.
> >
> > > Bo
> >
> > Regds,
> > Gokul
> > [...]
>
> Hi Gokul,  thanks for your email! :-)the following is my new
understanding
> of SingleThreadModel  after I read your email:
>
> # if my Servlet class implements SingleThreadModel, then for every
Servlet
> definition,
>Servle

RE: Servlet -- SingleThreadModel

2001-04-13 Thread Craig Pfeifer

> I have a servlet implements the SingleThreadModel
> Interface. But this servlet has problem handle more
> than 1 request at a time.

I thought that this was the definition of a SingleThreadModel servlet? To
enable this servlet to handle > 1 request, you have to tell your servlet
container to create a pool of servlet instances.

So, solutions include:

- create a pool of SingleThreadModel servlets to handle multiple requests,
delegating threadsafety

- remove the SingleThreadModel interface from your servlet and handle the
synchronization yourself (level of difficulty determined by what your
servlet does)

Craig Pfeifer
Software Engineer
Aether Systems, Software Products Division
703.847.3303 x2053
[EMAIL PROTECTED]

  


> -Original Message-
> From: eric leung [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 12, 2001 7:03 PM
> To: [EMAIL PROTECTED]
> Subject: Servlet -- SingleThreadModel
> 
> 
> I have a servlet implements the SingleThreadModel
> Interface. But this servlet has problem handle more
> than 1 request at a time. 
> 
> Since I have 1 person on host1 upload a big file ( >
> 20MB ) to the servlet.  When the 2nd person on host2
> send a request to that servlet. The servlet will not
> response. 
> 
> Any one had the same problem using SingleThreadModel? 
> I am using apache 1.3.17 + tomcat 3.2.1.
> thanks.
> 
> 
> P.S. I use SingleThreadModel beause i don't want to
> worry about syncronization of threads, I have
> Connection as instance variable:
> 
> public class admin extends HttpServlet implements
> SingleThreadModel{
>   private PrintWriter out;
>   private OracleConnectionCacheImpl pool;
>   private Connection conn;
>   private Statement stmt;
> 
>   ..etc...
>  
> 
> __
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/
> 



Re: Servlet -- SingleThreadModel

2001-04-12 Thread Jeff Kilbride

That's the whole point of SingleThreadModel, ensuring only one request
accesses a given servlet instance at any one time. Check the javadoc:

http://tomcat.mslinn.com/jsp22_servlet11/index.html

To handle more than one request at a time, the servlet container uses a pool
of instances of the servlet that implements the SingleThreadModel interface.
However, if your "Connection" resource, the one you're trying to
synchronize, can only be used by one servlet instance at a time,
SingleThreadModel pooling is not going to help you. The servlet instances in
your pool are going to "line up" behind the one currently using your
"Connection" resource.

What kind of "Connection" are you trying to synchronize? Are you limited to
having only one "Connection" at any one time? If so, your bottleneck is your
"Connection" resource and not the SingleThreadModel interface.

Maybe if you post some of your code, we can help you figure out a better way
to implement it.

Thanks,
--jeff

- Original Message -
From: "eric leung" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2001 5:12 PM
Subject: Re: Servlet -- SingleThreadModel


> David,
> Thanks your suggestion.
>
> But I don't think this is a good solution. i have
> already 50Kb of code in that servlet class. if i need
> to move it to another class. that will be alot of
> work.
>
> My question is why implement SingleThreadModel
> interface can't handle more than 1 request at a time?
> Since i will have only 3 clients. I think
> SingleThreadModel is the best solution, without the
> need to worry about threading issue.
>
>
> --- David Crooke <[EMAIL PROTECTED]> wrote:
> > Make your connection etc. stack variables instead,
> > by creating a class
> > to contain them and move all your code into that
> > class - then have the
> > empty servlet "new" an instance and call the service
> > method. This way
> > you can use instance variables and the
> > Multi-Threaded Model.
> >
> > eric leung wrote:
> >
> > > I have a servlet implements the SingleThreadModel
> > > Interface. But this servlet has problem handle
> > more
> > > than 1 request at a time.
> > >
> > > Since I have 1 person on host1 upload a big file (
> > >
> > > 20MB ) to the servlet.  When the 2nd person on
> > host2
> > > send a request to that servlet. The servlet will
> > not
> > > response.
> > >
> > > Any one had the same problem using
> > SingleThreadModel?
> > > I am using apache 1.3.17 + tomcat 3.2.1.
> > > thanks.
> > >
> > > P.S. I use SingleThreadModel beause i don't want
> > to
> > > worry about syncronization of threads, I have
> > > Connection as instance variable:
> > >
> > > public class admin extends HttpServlet implements
> > > SingleThreadModel{
> > >   private PrintWriter out;
> > >   private OracleConnectionCacheImpl pool;
> > >   private Connection conn;
> > >   private Statement stmt;
> > >
> > >   ..etc...
> > >
> > >
> > > __
> > > Do You Yahoo!?
> > > Get email at your own domain with Yahoo! Mail.
> > > http://personal.mail.yahoo.com/
> >
> > --
> > David Crooke, Chief Technology Officer
> > Convio Inc. - the online partner for nonprofits
> > 4801 Plaza on the Lake, Suite 1500, Austin TX 78746
> > Tel: (512) 652 2600 - Fax: (512) 652 2699
> >
> >
> >
>
>
> __
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>




Re: Servlet -- SingleThreadModel

2001-04-12 Thread eric leung

David,
Thanks your suggestion.

But I don't think this is a good solution. i have
already 50Kb of code in that servlet class. if i need
to move it to another class. that will be alot of
work.

My question is why implement SingleThreadModel
interface can't handle more than 1 request at a time?
Since i will have only 3 clients. I think
SingleThreadModel is the best solution, without the
need to worry about threading issue.


--- David Crooke <[EMAIL PROTECTED]> wrote:
> Make your connection etc. stack variables instead,
> by creating a class
> to contain them and move all your code into that
> class - then have the
> empty servlet "new" an instance and call the service
> method. This way
> you can use instance variables and the
> Multi-Threaded Model.
> 
> eric leung wrote:
> 
> > I have a servlet implements the SingleThreadModel
> > Interface. But this servlet has problem handle
> more
> > than 1 request at a time.
> >
> > Since I have 1 person on host1 upload a big file (
> >
> > 20MB ) to the servlet.  When the 2nd person on
> host2
> > send a request to that servlet. The servlet will
> not
> > response.
> >
> > Any one had the same problem using
> SingleThreadModel?
> > I am using apache 1.3.17 + tomcat 3.2.1.
> > thanks.
> >
> > P.S. I use SingleThreadModel beause i don't want
> to
> > worry about syncronization of threads, I have
> > Connection as instance variable:
> >
> > public class admin extends HttpServlet implements
> > SingleThreadModel{
> >   private PrintWriter out;
> >   private OracleConnectionCacheImpl pool;
> >   private Connection conn;
> >   private Statement stmt;
> >
> >   ..etc...
> >
> >
> > __
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail.
> > http://personal.mail.yahoo.com/
> 
> --
> David Crooke, Chief Technology Officer
> Convio Inc. - the online partner for nonprofits
> 4801 Plaza on the Lake, Suite 1500, Austin TX 78746
> Tel: (512) 652 2600 - Fax: (512) 652 2699
> 
> 
> 


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



Re: Servlet -- SingleThreadModel

2001-04-12 Thread David Crooke


Make your connection etc. stack variables instead, by creating a class
to contain them and move all your code into that class - then have the
empty servlet "new" an instance and call the service method. This way you
can use instance variables and the Multi-Threaded Model.
eric leung wrote:
I have a servlet implements the SingleThreadModel
Interface. But this servlet has problem handle more
than 1 request at a time.
Since I have 1 person on host1 upload a big file ( >
20MB ) to the servlet.  When the 2nd person on host2
send a request to that servlet. The servlet will not
response.
Any one had the same problem using SingleThreadModel?
I am using apache 1.3.17 + tomcat 3.2.1.
thanks.
P.S. I use SingleThreadModel beause i don't want to
worry about syncronization of threads, I have
Connection as instance variable:
public class admin extends HttpServlet implements
SingleThreadModel{
  private PrintWriter out;
  private OracleConnectionCacheImpl pool;
  private Connection conn;
  private Statement stmt;
  ..etc...
 
__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

-- 
David Crooke, Chief Technology Officer
Convio Inc. - the online partner for nonprofits
4801 Plaza on the Lake, Suite 1500, Austin TX 78746
Tel: (512) 652 2600 - Fax: (512) 652 2699
 


Servlet -- SingleThreadModel

2001-04-12 Thread eric leung

I have a servlet implements the SingleThreadModel
Interface. But this servlet has problem handle more
than 1 request at a time. 

Since I have 1 person on host1 upload a big file ( >
20MB ) to the servlet.  When the 2nd person on host2
send a request to that servlet. The servlet will not
response. 

Any one had the same problem using SingleThreadModel? 
I am using apache 1.3.17 + tomcat 3.2.1.
thanks.


P.S. I use SingleThreadModel beause i don't want to
worry about syncronization of threads, I have
Connection as instance variable:

public class admin extends HttpServlet implements
SingleThreadModel{
  private PrintWriter out;
  private OracleConnectionCacheImpl pool;
  private Connection conn;
  private Statement stmt;

  ..etc...
 

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



Re: Does Tomcat3.2.1 use a servlet pool in SingleThreadModel

2001-03-09 Thread Andrew Robson

Hi,
  No. It synchronizes the calls to the service method (see Craig McLanahan's
post from 2nd of March). That tomcat properly implements SingleThreadModel
should be easy to verify by generating a unique id for each of your requests and
tracing their execution.
Andrew

On Fri, 09 Mar 2001, you wrote:
> Hello,
> 
> I am testing the SingleThreadModel. My test way was to write a servlet which will 
>take 3 minutes to process a request. Then I opened serveral browsers to send requests 
>almost in the same time. Form the responses, I found out that all the responses were 
>generated by the same servlet instance. 
> 
> Does Tomcat3.2.1 use a servlet pool in SingleThreadModel? If my test mehod is wrong?
> 
> Best Regards
> Zou Hua
-- 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Does Tomcat3.2.1 use a servlet pool in SingleThreadModel

2001-03-08 Thread Zou Hua

Hello,

I am testing the SingleThreadModel. My test way was to write a servlet which will take 
3 minutes to process a request. Then I opened serveral browsers to send requests 
almost in the same time. Form the responses, I found out that all the responses were 
generated by the same servlet instance. 

Does Tomcat3.2.1 use a servlet pool in SingleThreadModel? If my test mehod is wrong?

Best Regards
Zou Hua



Tomcat Servlet SingleThreadModel Question

2001-02-27 Thread Walter Prabhakar

Hello Kief,

  How is SingleThreadModel handled in Tomcat 3.2.1 ?
Is it possible to specify Min and Max Threads ( assuming that if a thread is 
free a Servlet can be instatiated and executed in that thread ) in Tomcat 
3.2.1 so that the response time is less and at the same time the CPU is not 
burnt ?

Thanks for your time.

Yours Servlet Friendly

Walter G. Prabhakar.
http://www.billsofindia.com

_
Get your FREE download of MSN Explorer at http://explorer.msn.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Tomcat-- SinglethreadModel

2001-01-23 Thread Kief Morris

Saikat Chatterjee typed the following on 01:25 PM 1/23/2001 +0530
>I have a question regarding Tomcat. Does Tomcat implements the
>servlets as SingleThreadModel or MultipleThreadModel?

Both. According to the servlet spec, by default servlets allow multiple threads,
so multiple users can be processed at the same time. If you configure your
servlet to be singlethreaded it will only handle one user at a time. A server can 
then create a pool of servlets to handle multiple requests, but Tomcat doesn't,
so using the single thread model means your servlet will be very slow if very many
people use it.

The reason Tomcat doesn't implement pooling for single threaded servlets is that
it's much more resource intensive than just using a single servlet with multiple
threads - your server would need more RAM, possibly more CPU, faster disk 
access, etc. to handle the same level of traffic. It's much better to take a little
bit of time to understand the concurrency issues and code carefully.

Kief


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Tomcat-- SinglethreadModel

2001-01-22 Thread Saikat Chatterjee

Hello all,
I have a question regarding Tomcat. Does Tomcat implements the
servlets as SingleThreadModel or MultipleThreadModel?

Thanks,
Saikat


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]