Page 1 of 1

About Question enthuware.jwpv6.2.572 :

Posted: Sun Feb 16, 2014 8:43 am
by DesRenthuware
Hi.

This question should be rated "evil". I knew there were (at least) two correct answers because during the course of my prep, I saw a tutorial on likely uses for async servlets which listed chat apps, db processes and webservices. Didn't (unfortunately) remember the example in the Servlet spec. SIGH....

Thanks.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Thu Jan 01, 2015 3:17 pm
by navaare
An online chat application.

Chat apps are very example of async communications which by definition users should not wait for response. There no good & better cases of usage a given solution but rather cases which can be used and it is ok or it is wrong and lead to issues. What is Enthuware team opinion?

Re: About Question enthuware.jwpv6.2.572 :

Posted: Thu Jan 01, 2015 9:37 pm
by admin
navaare wrote:An online chat application.

Chat apps are very example of async communications which by definition users should not wait for response. There no good & better cases of usage a given solution but rather cases which can be used and it is ok or it is wrong and lead to issues. What is Enthuware team opinion?
As mentioned in the explanation, it is a bit subjective and it is possible to use async api for chat application also. But I do not agree with your comment, "Chat apps are very example of async communications which by definition users should not wait for response. " because when you say user, you are thinking about actual person. But caller of the backend api is the client code. That code will need to get a response back from the server. The response is not a response from another user but the response from the servlet with pending messages or nothing or something else. So a chat application doesn't really need async api.

HTH,
Paul.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Sat Jan 03, 2015 1:48 pm
by navaare
Question : In which of the following scenarios, the Servlet Asynchronous API would be useful?
Correct answer : "Calling a web service from within a servlet for fulfilling a request."
Wrong answer : "An online chat application."

My question is:

Is it always better(or there are more cases) to use Async API for calling other web Services within a servlet than at chat app ?
Moreover, I think we not always need Async API for calling web services internally (same as chat apps).

I would agree with current correct answer in case of putting anywhere an attention to delay for waiting on response. Why so? Because In that case it might sound like

"Calling a web service from within a servlet for fulfilling a request optimizing servicing delays."
Logically it would also cover using Async API for chat apps.

BTW I would avoid comparing development implementation(calling web services internally) with a client/business requirement(chat app). These seems to me a different areas for consideration.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Sat Jan 03, 2015 9:44 pm
by admin
Again, as mentioned before, it is a subjective question and I already agreed with you in the previous post that async can be used for chat application. In fact, giving a name to an application (i.e a chat application or xyz application), the option becomes so vague that anything can be used. An application can do doing so many things and for some things async would be suitable and for something else it may not be. So saying that "async will be useful for a chat application" doesn't really mean much. That is why in our opinion this option is wrong.

Calling a web service is a precise activity without any confusion. Async call can be used for this purpose. That is why this option is right. Again, this is our opinion based on several things.

Please note that our only objective with this question here is to make you aware that such questions exist in the real exam as well. It is up to you to decide how you want to answer in the exam.

HTH,
Paul.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Sun Jan 04, 2015 5:13 am
by navaare
Somehow such approach is reasonable for me too. Thanks again Paul, for throughout explanation.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Sun Jun 12, 2016 8:09 pm
by himaiMinh
How about downloading a large file?
The servlet can start an asynchronous process to download the file.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Sun Jun 12, 2016 10:15 pm
by admin
Yes, possible. Please see the discussion above.

Re: About Question enthuware.jwpv6.2.572 :

Posted: Mon Jun 13, 2016 9:56 am
by himaiMinh
It seems that calling web services is more general than downloading a large file or chat application.
That is why calling web services is a safe option.