You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jo...@clearink.com on 2000/05/11 23:58:16 UTC

what happens to sessions?

Hey all,

What happens, in Tomcat, to session objects that have been created by a
servlet after a classloader reload? 

I just spent about 30 minutes trying to find what happens in the code, but
it is so badly documented I can't figure it out. :-(

Any pointers in the code or an answer would be appreciated. Essentially, I
need to have the session objects survive a classloader re-instantiation.

thanks,

-jon

-- 
Scarab -
      Java Servlet Based - Open Source 
         Bug/Issue Tracking System
        <http://scarab.tigris.org/>

Re: what happens to sessions?

Posted by Costin Manolache <co...@costin.dnt.ro>.
jon@clearink.com wrote:

> Hey all,
>
> What happens, in Tomcat, to session objects that have been created by a
> servlet after a classloader reload?
>
> I just spent about 30 minutes trying to find what happens in the code, but
> it is so badly documented I can't figure it out. :-(

Reloading is part of AdaptiveClassLoader and ServletWrapper.

ACL will detect if reload is needed, SW.handleReload() will
destroy the current servlet and reload.

Saving session data is not implemented in tomcat AFAIK.


> Any pointers in the code or an answer would be appreciated. Essentially, I
> need to have the session objects survive a classloader re-instantiation.

It's not easy, and I don't know anyone working on this.

Even if it will work- if you use this kind of features your code will only
work
on few servlet containers, reloading and saving session objects is not
required
AFAIK.  A much safer solution would be to do it yourself -> use an external
package ( loaded by the system loader ) or use the unbind() notification to
save in a database. Or just use EJBs...  It will be not only safer from the
point
of view of having this capability in all engines, but you'll also have full
control over what happens.




Costin


Re: what happens to sessions?

Posted by Costin Manolache <co...@costin.dnt.ro>.
> > What happens, in Tomcat, to session objects that have been created by a
> > servlet after a classloader reload?
> >
> > I just spent about 30 minutes trying to find what happens in the code, but
> > it is so badly documented I can't figure it out. :-(
> >
>
> Last time I looked at that particular piece of code, that was the conclusion I
> came to as well.
>
> There are other flaws in the current implementation of auto-reload in Tomcat
> 3.1 -- for example, it only checks for changes to servlet classes, not any
> other classes.

That's not true. We use the AdaptiveClassLoader from JServ and it does
check all the classes, not only the servlet.

Costin


Re: what happens to sessions?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
jon@clearink.com wrote:

> Hey all,
>
> What happens, in Tomcat, to session objects that have been created by a
> servlet after a classloader reload?
>
> I just spent about 30 minutes trying to find what happens in the code, but
> it is so badly documented I can't figure it out. :-(
>

Last time I looked at that particular piece of code, that was the conclusion I
came to as well.

There are other flaws in the current implementation of auto-reload in Tomcat
3.1 -- for example, it only checks for changes to servlet classes, not any
other classes.

>
> Any pointers in the code or an answer would be appreciated. Essentially, I
> need to have the session objects survive a classloader re-instantiation.
>

If your session objects implement Serializable, Catalina will do that :-) once
I finish implementing auto-reload.

>
> thanks,
>
> -jon
>

Craig