ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Kevin A. Burton)
Subject Re: [PROPOSAL] 'redefine' task that uses JDK 1.4/JPDA class redefinition
Date Mon, 04 Feb 2002 20:54:12 GMT
Hash: SHA1

"Steve Loughran" <> writes:

> What happens to objects which are stored in data structures after a reload if
> the no. or position of fields change?

Good question which is hard to find the answer to:

If a redefined class has instances then all those instances will have the fields
defined by the redefined class at the completion of the call. Preexisting fields
will retain their previous values. Any new fields will have their default
values; no instance initializers or constructors are run.

The canUnrestrictedlyRedefineClasses functionality is what is needed but JDK
1.4 doesn't support this.  Of course there is also NO documentation about when
this will happen.

God I hate closed source :(

> I ask as I had an experience on Tomcat 3.x with a dynamic reload of a servlet
> where an object saved to the ServletContext was still there, even after the
> classes signature changed.

yes... you can handle this.

> That's one reason I dont use dynamic reloading any more; just restart the
> whole web app.

Tomcat can't do dynamic reloading.  It can't reload a single class.  It has to
reload whole web contexts.  It may seem that you are just reloading one class
but really the ClassLoader just obsoleted itself and the new classloader
redefines clases.

For the time being the Redefine task will have to go hand and hand with web
application reloading.  They both have their advantages.


- -- 
Kevin A. Burton (,, )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber -,  Web -

Questions are the beginning of wisdom.
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Get my public key at:


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message