Forum Stats

  • 3,855,692 Users
  • 2,264,543 Discussions
  • 7,906,138 Comments

Discussions

Thread Safe Servlet

898516
898516 Member Posts: 11
edited Nov 16, 2011 10:59AM in Java Servlet
Hi,
How to write thread safe programme in servlet.

Thanks
Miku

Answers

  • gimbal2
    gimbal2 Member Posts: 11,949 Gold Trophy
    You don't write programs in servlets. Servlets may be components in a web application though.

    What you perhaps want is a good book. I suggest you give http://pdf.coreservlets.com a read, not only because it is free but also because it is very good. Whatever you do, you are not going to learn this by asking questions in a forum.
  • 796440
    796440 Member Posts: 19,179 Gold Trophy
    If you're asking how to make your servlet threadsafe, then:

    1) Making sure the Servlet itself has no member variables is one step. That will make that class threadsafe.

    2) Of course, your servlet might still me unsafely using other classes. For that, you make it threadsafe just like you do any other code.
This discussion has been closed.