Which of the following is a common practice for ensuring thread safety in servlets?

  • Avoiding the use of static variables
  • Releasing all resources in the destroy() method
  • Synchronization of the service() method
  • Using a single shared resource in the servlet
A common practice for ensuring thread safety in servlets is avoiding the use of static variables, as they can lead to conflicts when multiple threads are accessing the servlet concurrently.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *