Meaningless Drivel is fun!*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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

Synchronized problems in JSP/Servlet, please help me.


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.
Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
Your question is being answered here. Please, do not post the same question twice!
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:
subject: Synchronized problems in JSP/Servlet, please help me.
Similar Threads
number of instances of JSP
JDBC Newbie: Understaning 'Connection'
synchronized problems with JSP/Sverlet, please help!
Difference between Single and Multi Thread Model
synchronized problems in JSP/Sverlet, please help!