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();
}
}
-----------
about question enthuware.jwpv6.2.750
Moderators: Site Manager, fjwalraven
-
- Posts: 3
- Joined: Sat Jul 14, 2012 9:10 am
- Contact:
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: about question enthuware.jwpv6.2.750
As the explanation notes, request is considered thread thread safe as well.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Re: about question enthuware.jwpv6.2.750
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.
"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.
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: about question enthuware.jwpv6.2.750
You are right. This has now been fixed.
Thank you for your feedback!
Thank you for your feedback!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 122 guests