Hi Craig,
u said regarding HttpSession object created in doPost() or doGet(). I know
these facts(Pl correct if I am wrong) -
1. If many users are invoking the same servlet, then a Httpsession object
is created for each user. These session objects for different users are
existing in various threads(1 thread per servlet invocation) and don,t
share anything.
2. The Servlet environment identifies the sessions for users by means like
persistent cookies or url rewwriting mechanisms. If a particular user wants
to store some java object in his session object, it is done by calling
session.putValue(String,Object) method.
I am reading Jason Hunter's book. Its very well written.
Regards
--Mukul Gandhi
>The local variable comes into existence when the method gets called, but that
>does NOT guarantee that the object these variables refer to are thread safe..
>For example, if you have the following statement in your doGet() or doPost()
>method:
>
> HttpSession session = request.getSession(true);
>
>you have just created a local variable named "session", but the session
object
>itself is shared -- and, in particular, the objects that users store there
>with session.putValue() need to be designed to deal with a multi-threaded
>environment..
>
>The only time you have no worries at all is when:
>* You create a new variable (using the "new" operator or an appropriate
>factory method of an existing object)
>* The new object contains no references to other objects that might be
shared..
>
>The principles of programming for a multithreaded environment can be learned
>from Computer Science textbooks that discuss the topic, as well as language
>tutorials (such as the Java Language Tutorial at
>http://java.sun.com/docs/books/tutorial) that illustrate the concepts in
>depth..
>Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html