Nic Ferrier wrote:

> >>> Gokul Singh <[EMAIL PROTECTED]> 11-Jan-01 10:57:59 AM >>>
>
> >As far as my limited analysis of the problem after
> >peeking into the source code of Tomcat3.2.1, is
> >that it has switched to a facade pattern for handling
> >HttpSessions in 3.2.1 and the objects implementing
> >the facade are reused in different requests (as per
> >comments in source).
>
> This seems dumb to me.
>
> As far as I can see there is an implicit contract between the
> programmer and the container that Tomcat is breaking if it does this.
>
> Perhaps Craig (or someone equally knowledgeable) can explain on this
> list coz it does affect the portability of apps I think.
>

The problem is that Gokul is expecting the contents of the session instance he
stashed to be relevant after the session has been invalidated.  At *best* he
should expect to get IllegalStateException errors when he references it after
invalidation -- at worst he gets undefined behavior because he is outside the
boundary of what the spec guarantees.

In particular, the behavior difference between Tomcat 3.1 and 3.2 is that 3.1
did not recycle session object instances, and 3.2 does.

>
> Nic
>
> PS with 2.3 API we will have other ways of managing sessions (the
> session lifecycle events) but you still couldn't do this particular
> trick without storing the session reference somewhere.
>

Yes, and with session event listeners, you are notified when the session is
invalidated, so you can immediately remove your reference to it.

Craig

___________________________________________________________________________
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

Reply via email to