About Question enthuware.jwpv6.2.721 :

Moderator: admin

Post Reply
dhanuddhara
Posts: 12
Joined: Fri Aug 15, 2014 10:16 am
Contact:

About Question enthuware.jwpv6.2.721 :

Post 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.... ? :(

admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post by admin »

The question doesn't say that a request has been made for the servlet.
If you like our products and services, please help us by posting your review here.

dhanuddhara
Posts: 12
Joined: Fri Aug 15, 2014 10:16 am
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post 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.

admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post 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.
If you like our products and services, please help us by posting your review here.

dhanuddhara
Posts: 12
Joined: Fri Aug 15, 2014 10:16 am
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post 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

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post 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?

admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post by admin »

Yes, if the servlet is still in the middle of processing a request, destroy will not be called.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.721 :

Post by johnlong »

Thank you

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests