[kepler-dev] [Bug 1750] - create dynamic loading of objects in kepler via kar files
bugzilla-daemon at ecoinformatics.org
Fri Jan 21 08:12:42 PST 2005
------- Additional Comments From cxh at eecs.berkeley.edu 2005-01-21 08:12 -------
Below is a little info about dynamic class reloading in Vergil from Steve
Neuendorffer. Reloading a class is harder than loading it.
At 04:45 PM 9/9/2000 -0700, Steve Neuendorffer wrote:
>I've been looking at making Vergil capable of dynamic class reloading.
>With a little assistance from some discussions with Jorn, I figured out
>what I done incorrectly before. The basic principle is that you can
>reload classes If and only if:
>1) The classes are NOT accessible to the bootstrap class loader i.e. they
>are not listed in the JVM's classpath.
>2) The interfaces that are used to refer to those classes are not
>For example: we can reload actor.lib.Ramp by removing it from it current
>location and putting it somewhere else. This works because all the
>important thing about it (such as the actor and port interfaces) are not
>reloaded. So I can say:
>Classloader c = new URLClassLoader(SOMEURL, getClass().getClassLoader())
>and then use that classloader to reflect the ramp actor.
>Later I could throw away that class loader and create a new one and the
>classes would get reloaded. Notice that the old classes (and instances)
>are not removed from the JVM... some other mechanism is resplosible for
>keeping track and reinstantiating everything.
>I had added support in the MoMLParser for specifying a class loader
>before. All I do now is just create a new classloader everytime the
>classes in the "dynamicClassPath" need to be reloaded. I haven't checked
>these changes in yet, but I will soon.
More information about the Kepler-dev