File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes synchronized problems in JSP/Sverlet, please help! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

synchronized problems in JSP/Sverlet, please help!

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
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
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 ]

Dave
 
 
subject: synchronized problems in JSP/Sverlet, please help!
 
Threads others viewed
why jsp cannot use this class, which is no problem when compile singlely.
JDBC Newbie: Understaning 'Connection'
number of instances of JSP
synchronized problems with JSP/Sverlet, please help!
Synchronized problems in JSP/Servlet, please help me.
developer file tools