In Head First Servlet and JSP, they have mentioned session and context attributes are not thread safe and only the request attributes are thread safe. So we don't need to synchronize the request object like synchronize the session and context object. If so, my doubt is why request object is synchronised in <jsp:useBean.. scope="request"> page no:348 - chapter - 8 in HFSJ
Mike Thomson
Ranch Hand
Joined: Nov 07, 2007
Posts: 115
posted
0
Let me rephrase my question:
"Is there under any circumstance/necessary to synchronize the request object?"
I know request attributes are thread safe and no need to synchronize as we are doing for context and session.
But in the Head first Servlets and JSP book, for <jsp:useBean.. scope="request">, the generated servlet code in _jspService() method, they have synchronized the request object like below: