Kathy and Bryan mention in their book HFS&J that the service() method in servlets is called by the container.How is it done?I believed that the container just created a thread and "started" it and then it was the run() method of the thread that had a call to service() which in turn would call doXXX().
I believe you're dead on, Mayank. However, I believe some containers will utilize a thread pool, rather than always creating a new thread. So, it may be possible that the container will reuse a thread, rather than making a new one for each request. Regardless, the thread assigned to the request is responsible for invoking the service() method of the HttpServlet.