This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
if service() method of a typical servlet is multithreaded, which one of the following issues does not need to be address in the servlet's implementation? Concurrent access to =>>shared resouces ? local variables?static variables? instance variables?
thanks [ April 01, 2002: Message edited by: Roland2k1 ]
1. Access to shared resouces outside the servlet is a concern, even if you are implementing SingleThreadModel, because all that is guaranteed is that only one thread will execute the service() method at a time. 2. Local variables are as thread-safe as they can be, since each thread as its own "copy". 3. Static variables are not thread-safe, even if you implement SingleThreadModel, because the specs allow the container to create a pool of servlets. 4. Instance variables are not thread safe. Even though only one servlet instance (per servlet definition) services requests, concurrent requests will spawn threads that can access that servlet's instance variables. You can check out more of the specs here. It's actually very readable and informative -anthony