Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Safe  RSS feed

 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
Can you help me to explain about Thread Safe in Servlet and JSP page?
daniel
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Daniel
Basically an instance of a servlet class (and consequentially a JSP) can handle multiple simultaneous HTTP requests. On receipt of an HTTP request for a URL the Web Container will invoke the appropriate service method (i.e. doGet, doPost() ) on the servlet that is 'listening' on the URL.
The simplest way to ensure that a servlet can handle multiple HTTP requests (i.e. is Thread-safe) is to avoid the use of instance variables defined on the servlet class (except perhaps those which are initialised in the init() method and then never changed!).
HTH
Andy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!