tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manpreet Singh" <msi...@india-today.com>
Subject Re: servlet question !!
Date Sat, 01 Jan 2000 02:33:01 GMT
Thanks Jim,

Your answer made many things clear.
The actual problem that im facing is that I want to serve a different set of
instance variables to each client that requests this servlet.
I can use SingleThreadModel interface but that will slow down things.
Is there any other way the instance variables can be served differently for
each client .

thanks in advance,
Manpreet Singh.


----- Original Message -----
From: James Cook <jimcook@iname.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Thursday, June 08, 2000 6:30 PM
Subject: Re: servlet question !!


> Manpreet,
>
> Consider that there is one instance of this class living in the servlet
> engine. The first request to this servlet will cause the servlet to be
> initialized. Count will equal 0. The output will be count++, or 1.
> Subsequent requests (by the same client or others) will continue to
> increment count. This will return 2, 3, 4, etc.
>
> BTW, the servlet is reentrant, meaning that one or more of these clients
can
> be in the servlet concurrently. It is possible that two clients hitting
your
> code could return the same output value.
>
> jim
>
> ----- Original Message -----
> From: Manpreet <manpreetnagpal@yahoo.com>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Thursday, January 06, 2000 3:47 PM
> Subject: servlet question !!
>
>
> HI all,
>
> I have a small servlet code like this:
>
> import java.io.*;
> import javax.servlet.*;
> import java.servlet.http/*;
>
> public class Test extends HttpServlet {
>         int count=0;
>         public void doGet(HttpServletRequest req , HttpServletResponse
res)
> throws         IOException , ServletException {
>             PrintWriter out=res.getWriter();
>             out.write(count++);
>         }
> }
>
> Is it possible that each request to this servlet gets the initial value of
> count i.e. 0
>
> thanks in advance ,
> Manpreet Singh.
>
>
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


Mime
View raw message