tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugen Kuleshov <a...@hco.kollegienet.dk>
Subject Re: Servlet reloading?
Date Sat, 12 Feb 2000 21:25:05 GMT
Hans Bergsten wrote:
 
> > > > NOOOOO. I spent many many many many weeks getting this right in Apache
> > > > JServ. Look at my code. There is a whole process that is done to serialize
> > > > and de-serialize everything that needed to be serialized.
> > >
> > >   What about situation when some session saved classes changed?
> > >   What about situation when reloaded servlets changing execution logic?
> > > I mean new servlets no more needs (or needs another) data in session.
> > >   Maybe better way is killing all session data for new servlets.
> > >
> > >   Eugen Kuleshov.
> >
> > No. I do not think you understand the problem I was talking about. The
> > issue is simply put:
> >
> > Sessions are created within the AdaptiveClassloader scope. When you kill
> > that classloader, the HttpSession objects (and all the objects within
> > there) become invalid because Java objects are associated with their
> > classloader.
> >
> > There is a way to "copy" those HttpSession objects into a new
> > classloader by serializing them to an outputstream, (not a file or disk or
> > whatever) and then de-serializing them from that same stream, but in the
> > context of the new classloader instance. There are a
> > few gotcha's that you have to consider when doing this, but I have the
> > problem solved...at least within Apache JServ. Look at the source code. It
> > is really quite clear.
> >
> > Essentially, it allows those session objects to remain valid even though
> > their parent classloader was killed.
> 
> But don't you still have a problem if the class for one of the objects
> in a session has been changed, for instance, an instance variable has been
> removed or added? When you try to "copy" it into the new class loader, the
> serialized format doesn't match the new class. And in some cases, like
> Eugen mentioned, the new version of the servlet may not even want the old
> session data.

  Exactly!

  Eugen Kuleshov.

Mime
View raw message