I dis agree with Shweta in 2 manners:
=> Specification
If a servlet implements this interface, you are guaranteed that no two threads will
execute concurrently in the servlet�s service method
there is no guarantee for Variables who r Instance variable.
=> Maintaining pool of Instances (Each request must hv an individual and unique instance) would help u to make Instance variable Thread safe. But synchronize access to service method will not help u to make Instance variable THERAD SAFE.
=> <b> Either maintaining Instances of Servlets or make a syanchronized access to service method is a container specific issue.</b> Specification has written that, it is not binding container for which approch to follow.
Shweta, i hv checked up at Manning book, Manning book has written the way u hv posted. But i m posting a same question for Book Authors at jdiscuss.com.
Best Regards, Dharmin
[ February 04, 2003: Message edited by: Dharmin Desai ]
[ February 04, 2003: Message edited by: Dharmin Desai ]