Dynamic plugin (re)loading .... Now with dependency loading
Submitted by epr on Sun, 04/11/2004 - 14:56.
I'm glad to announce that i've finally managed to dynamically load, unload, reload & use a plugin.
For this to work, the "plugin" command has been extended with the following commands: addloader, load, unload, reload.
Now an example:
I made an Alias (/plugins) in apache to the <jnode>/all/build/x86/netboot/plugins directory.
> bootp eth1
> plugin addloader http://<my-server-ip>/plugins
> plugin load org.jnode.fs.ext2.test.command
And the ext2 test commands are available.
Dependencies are loaded automatically.
Unloading and reloading also works. If a class of a plugin has active instances, they are not removed, unless these instances are made aware of it (like drivers).
Ewout
- Login to post comments
Probelm with resource files
It is great to have all these useful features implemented!
I made some tests and the plug-in loading and unloading seems to work.
I also tried the device unloading and that seems to work too,
however I get a ConcurentModificationException when I load the disk plug-in after an unload or when I simply use reload.
This happens quite regularly on my system, so here is the exception:
java.util.ConcurrentModificationException:
java.util.HashMap$HashIterator!hasNext (806)
org.jnode.driver.DefaultDevixeManager!findDeviceDrivers(413)
org.jnode.driver.DefauktDeviceManager!extensionAdded(610)
org.jnode.plugin.model.ExtensionPointModel!fireExtensionAdded(160)
(I hope this is enough)
Though the plug-ins that come with JNode work I got a problem with the resource files when I tried to use a manually assembled plug-in.
(This is nice too, that now you just add a plugin.xml to a .jar with the required package info, permissions, etc... and you can load it without a restart) This is again about kjc that I tried last time with the modified java command but got a similar error. When the getopt gnu program tries to load the resource bundle with the messages the bundle is not found. It looks like the findResource() in PluginClassLoader (which is known to work) doesn't get called. The resource is being tried to get loaded by an other class loader that cannot see the classes of the plug-in. It looks like the exception occurs during the initialization of a class.
This looks like a bug to me.
Levente
ConcurrentModificationException
Should be fixed now in CVS HEAD, please verify.
Ewout
Test program
Hi,
About the resource files, have you got a small test program that shows the problem?
Ewout
Good new
It is a very good new!
Now we not need reboot all time JNODE for make test.