Bookmark Topic Watch Topic
  • New Topic

synchronized problems in JSP/Sverlet, please help!  RSS feed

 
urey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Report post to moderator
urey
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
Please do not cross post your questions to multiple forums. Most of the visitors here read in many of the forums and it is frustrating to see the same question repeated over and over. You have a better chance of getting a correct and timely answer if you post it to the most appropriate forum instead of using the shotgun approach and hoping you'll hit something.
Please post any additional posts about this to the thread you have started in the JSP forum right here
[ April 30, 2002: Message edited by: Dave Vick ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!