Page 1 of 1

About Question enthuware.jwpv6.2.721 :

Posted: Tue Sep 02, 2014 7:52 am
by dhanuddhara
As I know, the servlet engine will not create an instance, unless a request for that servlet is made. And if their is a request, the service method of that servlet is getting called.

According to that, option one also should be a correct answer.
what am i missing.... ? :(

Re: About Question enthuware.jwpv6.2.721 :

Posted: Tue Sep 02, 2014 9:16 am
by admin
The question doesn't say that a request has been made for the servlet.

Re: About Question enthuware.jwpv6.2.721 :

Posted: Wed Sep 03, 2014 9:35 am
by dhanuddhara
Actually the question saying;
Assuming that the Servlet Container has just called the destroy() method of a servlet instance,
and one of the explanation saying;
destroy() method is called only if the servlet was made ready to service request,which means, its init() method was called.
Then my point is;
If their is an instance of a servlet in the container, it convincing at-least one request for that servlet has been made. it means the service method of the instance has also been called. Then option one also getting a correct answer.

I'm just telling my point, thank you.

Re: About Question enthuware.jwpv6.2.721 :

Posted: Wed Sep 03, 2014 11:46 am
by admin
I understand your point but it is not correct. "servlet was made ready to service request" doesn't mean there was a request. A servlet can be pre-loaded as well (without any request) at the time of startup of a webapp.

Re: About Question enthuware.jwpv6.2.721 :

Posted: Thu Sep 04, 2014 2:30 am
by dhanuddhara
I got it.
Their is a tag for use in web.xml to load an instance of servlert on start-up.
***<load-on-startup>***
Thanks Mr.Paul

Re: About Question enthuware.jwpv6.2.721 :

Posted: Wed Aug 17, 2016 1:58 pm
by johnlong
There are no container threads running over this instance's service method.
Question : does it mean that destroy would not be called unless complete is called on AsyncContext?

Re: About Question enthuware.jwpv6.2.721 :

Posted: Wed Aug 17, 2016 8:56 pm
by admin
Yes, if the servlet is still in the middle of processing a request, destroy will not be called.

Re: About Question enthuware.jwpv6.2.721 :

Posted: Thu Aug 18, 2016 12:25 am
by johnlong
Thank you