Example & Tutorial understanding programming in easy ways.

What is SingleThreadModel interface in servlet?

The SingleThreadModel interface is defined in javx.servlet package and it was provided for thread safety point of view for the servlets and it will make sure that no two threads will execute concurrently in the servlet’s service method to make servlets thread safe. 


In servlets there in not the 100% safety in this thread modal it still makes issues for session attributes and static variables they can still be accessed by multiple requests on multiple threads at the same time and there is a risk of data security and safety, even when SingleThreadModel servlets are used. Now This interface is Deprecated in Servlet 2.4. The thread safety is still an issue in the full proof and efficient servlet programing.

Read More →