There seems to be a little bug or at least a documentation problem with the bundle util.
When i add a bundle in ModuleHook.setup with BundleUtil.get().addBundle(xxx.class); and remove it in ModuleHook.shutdown with BundleUtil.get().removeBundle(xxx.class); there is still a reference to my class on the heap. As the built in drivers seem to to use this remove method (the Modbus driver in the api example definitely does), you will always have duplicate classes after a driver restart. This causes problems when trying to debug in development mode, since the VM seems to use parts of the old jar file instead of the newly uploaded one.
When is use BundleUtil.get().removeBundle(xxx.class.getSimpleName(); instead, everything works as expected.
If this is a intended behavior of BundleUtil.remove(Class) it would be good to mention it in the javadocs.
By the way, is it correct that the 7.4 api still expects api version 3 in ModuleHook.startup?
Thanks for the heads up. The docs aren’t wrong (It is removing your bundle), but there is an implementation issue that’s leaving a reference to your module’s ClassLoader when you use the removeBundle(Class) overload, as you reported.
Yes, that's correct. I don't think anything in the Driver API changes in a backwards-incompatible way between 7.3 and 7.4, like it did between 7.2 and 7.3.
So I realise this thread is 12 years old but was this bug ever fixed? I just fixed a very weird issue with module restarts reporting it couldn't find some resources by adding the getSimpleName() fix to removeBundle.
haha, ok, thanks for the prompt reply. Maybe a note in the documentation would be useful. Hopefully people facing similar issues will find this thread.
I didn't think it was a mistake when first announced. It took a few months of paying attention to how often my clients and I would upgrade modules, or add newly licensed modules to running systems, or drop modules. Every one of those would have been a scheduling nightmare.
I was entirely convinced by last ICC.
Even with redundant systems, there's a data loss window during switchover. I'll take another stab at talking Carl out of this in September.