• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Thread Safe

 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
Can you help me to explain about Thread Safe in Servlet and JSP page?
daniel
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic