about question enthuware.jwpv6.2.750

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
vgarg
Posts: 3
Joined: Sat Jul 14, 2012 9:10 am
Contact:

about question enthuware.jwpv6.2.750

Post by vgarg »

per explanation (and my understanding as well) only "baz" variable is thread safe.
while the question says there are 2 correct options.. please explain.

code snippet:
---------------
import ...;
public CrazyServlet extends HttpServlet
{
private StringBuilder foo = new StringBuilder();
private static StringBuilder bar = new StringBuilder();
public void service(HttpServletRequest req, HttpServletResponse res)
{
StringBuilder baz = new StringBuilder();
HttpSession session = req.getSession();
}
}
-----------

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

Re: about question enthuware.jwpv6.2.750

Post by admin »

As the explanation notes, request is considered thread thread safe as well.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

viva

Re: about question enthuware.jwpv6.2.750

Post by viva »

In the explanation:
"For a servlet that does not implement SingleThreadModel:

Thread Safe: request, response and local variables.
Rest all are unsafe.
"

When we have asynch processing request is not thread safe (and maybe response?)

If this is correct for request then maybe option 3 must be wrong.

viva

Re: about question enthuware.jwpv6.2.750

Post by viva »

sorry ignore my last sentence about option 3

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

Re: about question enthuware.jwpv6.2.750

Post by admin »

You are right. This has now been fixed.
Thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 122 guests