Hi,
The lines below which Craig has written seem to be quite important to
understand. But here I have a confusion. Say in doGet() method I write a
statement creating a session object [ HttpSession session =
request.getSession(true) ]. Lets assume sessions are managed using
persistent cookies.
Now lets say a particular user has invoked a servlet from a particular
client PC. Now that user's session is maintained by a cookie set by the
servlet on his PC. Lets now say the same user on the same PC invokes the
servlet again(either simultaneously or after some time lag). This another
request by the same user would overwrite the cookie on his PC. Or does here
the cookie is created new for another request by the same client ?
I think it could be a different cookie. If its a different cookie then the
same person is operating two sessions, otherwise there is only one session
for that user.
If there are seperate cookies for two invocations by the same client PC,
then by identifying that cookie in servlet we could run different code for
the same client. Otherwise, if cookie is same(i.e overwritten) for two
different invocations from the same PC, everytime a new session is supposed
to be created.
Can somebody please clarify these concepts ? Specially synchronisation
issue involved here(in relation to cookies & also using url rewriting
mechanism).
-mukul
>> No, you cannot assume that this fact *alone* makes you thread-safe,
>> because you
>> cannot assume that the same user will not trigger more than one request at
>> the
>> same time (which would be handled by different threads accessing the same
>> session
>> object)..
>>
> [Scheiderer, Stephan]
> SO, do I have to synchronize session object access??? (If a user
>makes 2 requests at one time...)
> [Scheiderer, Stephan] ????????????????
> Does that anybody of you? Is this really necessary?
___________________________________________________________________________
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