Results 1 to 4 of 4
Thread: Instance Variable In Servlet
- 06-13-2008, 01:47 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 91
- Rep Power
- 0
- 06-13-2008, 02:02 PM #2
Yes. The code is exactly the same as always. Try it, see what you get.
- 06-13-2008, 02:09 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 91
- Rep Power
- 0
It Compiles. But In Running Environment Is There Any Problem?
- 06-14-2008, 08:28 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Web Application Servers are threaded and normally operate as follows:
1. The Web Container instantiates the servlet as soon as the application context is started (or, by some, as soon as the first request for it comes in).
2. A request arrives for that servlet.
3. The Web Container starts a thread with this already instantiated Servlet.
As you can see from above, there is only one instance of this Servlet, regardless of the number of concurrent requests for it, so, the varying users using (and definately even worse changing) information in these instance variables will stepping all over each other, as they will all be using the same instance of the Servlet.
Similar Threads
-
instance access
By sujaiyer85 in forum Advanced JavaReplies: 2Last Post: 04-23-2008, 07:37 AM -
Exception Report:annot allocate servlet instance for path
By mary in forum Java ServletReplies: 4Last Post: 11-05-2007, 05:14 PM -
New Instance for SWT
By srinivasa_v in forum SWT / JFaceReplies: 1Last Post: 08-08-2007, 01:02 AM -
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2
By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM -
Instance variable
By Jack in forum New To JavaReplies: 2Last Post: 07-04-2007, 04:00 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks