File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Synchronized problems in JSP/Servlet, please help me. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Synchronized problems in JSP/Servlet, please help me. " Watch "Synchronized problems in JSP/Servlet, please help me. " New topic
Author

Synchronized problems in JSP/Servlet, please help me.

urey
Greenhorn

Joined: Apr 30, 2002
Posts: 3
There isn't a new instance of the Servlet/JSP for each request in Tomcat - they are probably all calling the same instance so any state will be shared. If I Connection is stored as a member variable then I'll have synchronized problems with it already being in use if two people hit the page at the same time.
Incidentally, although it might work, synchronizing the database access in the JSP would be a bad idea since I�d just create a queue of requests waiting to use the one Connection whereas I really need a number of Connections to deal with everyone simultaneously.
What I do? Need any advice from you.
Sincerely
Urey
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Your question is being answered here. Please, do not post the same question twice!
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Not only that, but your name isn't compliant with the Javaranch naming policy. Please choose a name that meets the requirements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronized problems in JSP/Servlet, please help me.