Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Servlets and Threading


Message #1 by "Chris Cloughley" <cloughleyc@c...> on Thu, 9 Nov 2000 23:13:37 -0000
Can someone put me straight on making thread safe code. I know that if
class variables are used within a servlet then the servlet is not thread
safe, unless protection such as synchronization is applied.

However what about the case where the servlet creates and uses an
instantiation of an object whos class uses class variables? Does the
rational behind the arguement for the servlet class hold for the
instantiated class, or because you instantiate the object within the
doGet() method of the servlet is the instance safe by some mechanisim to
do with the seperate method stack?

Any advice would be gratefully recieved.

Chris

  Return to Index