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
- 
				vgarg
 - Posts: 3
 - Joined: Sat Jul 14, 2012 9:10 am
 - Contact:
 
- 
				admin
 - Site Admin
 - Posts: 10443
 - 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.
- 
				viva
 
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.
- 
				admin
 - Site Admin
 - Posts: 10443
 - 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!
Who is online
Users browsing this forum: Google [Bot] and 30 guests