You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Razvan Dani <dr...@arobs.com> on 2003/03/19 00:08:27 UTC

SingleThreadModel and multiple servlet instance

Hi

I recently noticed that some of my servlets have a strange behaviour
when concurential requests are made to them (mainly becase there are
some variables defined in those servlets).

I also recently found that by using "implements SingleThreadModel" i
avoid this problem (pretty much by synchronizing the doGet and doPost).
But this raises to me the problem that i won't be able to serve more
request from that servlet at (almost) the same time. The second request
will wait for the first one to completelly finish ...

Due to this, i'd like to combine "implements SingleThreadModel" with the
ability to somehow have multiple servlet instances, instead of just one.

By surfing the Interned i was driven to the conclusion that some servlet
engines have some configurations available in order to specify the max
number of instances for a single servlet class.

My question is if there is any version of Tomcat that have such a
feature available or not. If not, a simple answer saying so would be
good enough for me. If yes, i would apreciate a lot any guidelines that
you could have to drive me to the right direction.

Thanks in advance
    Razvan Dani
--
Razvan Dani
ARoBS Transilvania Software
- the outsourcing solution for your company !

11 Donath Str , M4 - 28
3400 Cluj-Napoca, Romania

Main:   +40 264 198 204
Fax:     +40 264 198 426
email:  dr@arobs.com
www.ARoBS.com



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


Re: SingleThreadModel and multiple servlet instance

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: "Remy Maucherat" <re...@apache.org>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 5:43 AM
Subject: Re: SingleThreadModel and multiple servlet instance


> Razvan Dani wrote:
> > Hi
> >
> > I recently noticed that some of my servlets have a strange behaviour
> > when concurential requests are made to them (mainly becase there are
> > some variables defined in those servlets).
> >
> > I also recently found that by using "implements SingleThreadModel" i
> > avoid this problem (pretty much by synchronizing the doGet and doPost).
> > But this raises to me the problem that i won't be able to serve more
> > request from that servlet at (almost) the same time. The second request
> > will wait for the first one to completelly finish ...
> >
> > Due to this, i'd like to combine "implements SingleThreadModel" with the
> > ability to somehow have multiple servlet instances, instead of just one.
> >
> > By surfing the Interned i was driven to the conclusion that some servlet
> > engines have some configurations available in order to specify the max
> > number of instances for a single servlet class.
> >
> > My question is if there is any version of Tomcat that have such a
> > feature available or not. If not, a simple answer saying so would be
> > good enough for me. If yes, i would apreciate a lot any guidelines that
> > you could have to drive me to the right direction.
>
> All Tomcat 4.1.x releases have that.
>

As does Tomcat 3.3.1.

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


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


Re: SingleThreadModel and multiple servlet instance

Posted by Remy Maucherat <re...@apache.org>.
Razvan Dani wrote:
> Hi
> 
> I recently noticed that some of my servlets have a strange behaviour
> when concurential requests are made to them (mainly becase there are
> some variables defined in those servlets).
> 
> I also recently found that by using "implements SingleThreadModel" i
> avoid this problem (pretty much by synchronizing the doGet and doPost).
> But this raises to me the problem that i won't be able to serve more
> request from that servlet at (almost) the same time. The second request
> will wait for the first one to completelly finish ...
> 
> Due to this, i'd like to combine "implements SingleThreadModel" with the
> ability to somehow have multiple servlet instances, instead of just one.
> 
> By surfing the Interned i was driven to the conclusion that some servlet
> engines have some configurations available in order to specify the max
> number of instances for a single servlet class.
> 
> My question is if there is any version of Tomcat that have such a
> feature available or not. If not, a simple answer saying so would be
> good enough for me. If yes, i would apreciate a lot any guidelines that
> you could have to drive me to the right direction.

All Tomcat 4.1.x releases have that.

Remy


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


Re: SingleThreadModel and multiple servlet instance

Posted by Glenn Nielsen <gl...@mail.more.net>.
I would recommend refactoring the code for the servlet so that it is
thread safe and no longer needs to use SingleThreadModel.

Glenn

Razvan Dani wrote:
> Hi
> 
> I recently noticed that some of my servlets have a strange behaviour
> when concurential requests are made to them (mainly becase there are
> some variables defined in those servlets).
> 
> I also recently found that by using "implements SingleThreadModel" i
> avoid this problem (pretty much by synchronizing the doGet and doPost).
> But this raises to me the problem that i won't be able to serve more
> request from that servlet at (almost) the same time. The second request
> will wait for the first one to completelly finish ...
> 
> Due to this, i'd like to combine "implements SingleThreadModel" with the
> ability to somehow have multiple servlet instances, instead of just one.
> 
> By surfing the Interned i was driven to the conclusion that some servlet
> engines have some configurations available in order to specify the max
> number of instances for a single servlet class.
> 
> My question is if there is any version of Tomcat that have such a
> feature available or not. If not, a simple answer saying so would be
> good enough for me. If yes, i would apreciate a lot any guidelines that
> you could have to drive me to the right direction.
> 
> Thanks in advance
>     Razvan Dani
> --
> Razvan Dani
> ARoBS Transilvania Software
> - the outsourcing solution for your company !
> 
> 11 Donath Str , M4 - 28
> 3400 Cluj-Napoca, Romania
> 
> Main:   +40 264 198 204
> Fax:     +40 264 198 426
> email:  dr@arobs.com
> www.ARoBS.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 



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