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.
Loading...
Related Quiz
- What is the function of FilterMapping in a web application?
- Describe a scenario where file download in a servlet might fail and how to address it.
- Which XML element is used to declare a filter in a web application's deployment descriptor?
- What is the role of a servlet filter in security?
- The method __________ is used to get the vendor-specific error code in an SQL exception.