On another listserver, several of us have been having a discussion on
whether a JSP/Servlet programmer is required to synchronize his code that
accesses the session object, or whether the servlet container handles the
synchronization issues surrounding the session object for you. I've always
handled my own synchronization, and never really thought about this topic.
According to the Sun Servlet 2.2 and 2.3 standard, we found the following:
___________________________________
"7.7.1 Threading Issues
Multiple servlets executing request threads may have active access to a
single session object at the same time. The Developer has the responsibility
to synchronize access to resources stored in the session as appropriate."
______________________________________
BUT, another poster found the following code in Tomcat's StandardSession
object:
_________________________________________
Code from Tomcat's StandardSession object...
public Object getAttribute(String name) {
if (!isValid)
throw new IllegalStateException
(sm.getString("standardSession.getAttribute.ise"));
synchronized (attributes) {
return (attributes.get(name));
}
}
____________________________
I am NOT familiar with Tomcat as a Servlet container, my experience has been
mostly with Allaire's JRUN server. But we are interested in knowing if
someone with Tomcat experience can expand upon this topic. Does Tomcat
handle the synchronization of the session object for you, or are you as the
JSP/Servlet programmer required to handle synchronization. Are we confused
regarding the StandardSession object code in Tomcat posted above?
My thanks in advance to anyone who can elaborate on this topic.
Celeste
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com