Nithin
Nithin

Reputation: 255

What happens if multiple request's comes to a single servlet..?

Can anybody answer me in this issue..

What happens if multiple request's comes to a single servlet..?

i.e. Servlet will contains all the methods init(), service() and destroy() after destroy method without restarting the server i need to make call to the same servlet, then what happens to the servlet whether it will creates a new instance or i need to restart before calling the same servlet...

Thanks...

Upvotes: 2

Views: 4182

Answers (1)

Ramesh PVK
Ramesh PVK

Reputation: 15446

How and when the servlet instances are created is upto the container. Unless if specified as load-on-startup, which ensures the servlet instance is created on starting of the application.

Only thing we can specify is whether the servlet is javax.servlet.SingleThreadModel or not. If it is SingleThreaded the container will ensure that one servlet instance is used by one request/thread at any point of time.

Upvotes: 2

Related Questions