This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized problems in JSP/Servlet, please help me.

 
urey
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is being answered here. Please, do not post the same question twice!
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic