Processing of module disable should handle locks on module's jar file.
JarClassLoader.releaseLocks() has been called only on Module.destroy() and
should be called on Module.setEnabled(false) too.
Blocks Uninstall feature (issue 20323) on Windows OS.
Please also enhance ModuleManagerTest.testModuleDeletion to check that it works.
Created attachment 23161 [details]
implementation draft #1
Jesse, please for check up attached diff.
I'm not with implementation. I have removed a responsibility of releasing locks
from Module.destroy() for Module.classLoaderDown() but I have gone into problems
when appears a sequence module: disable->enable->disable. If disable() is called
on a recently disabled module then JCL throws ISE: Already had dead JARs.
In my draft I ignore this ISE and then ModuleManagerTest passes and it works for
me also in real. Please could you review if I'm on the right way? Thanks
If you are getting the ISE you are doing something wrong; should really be an
assertion error, I guess, but probably written before we were using JDK 1.4.
The patch has some mistakes. moduleJARs.remove(jar) must remain in destroy(); it
is the opposite of what is done in the Module constructor. And oldClassLoaders
*accumulates* class loaders (added to in every classLoaderUp), so it makes no
sense to iterate *all* of them with every disable.
You need to take a different approach, I think. Leave moduleJARs.remove(jar) in
destroy(). Remove the oldClassLoaders field entirely. Remove the releaseLocks()
method in JCL; instead, override PCL.destroy() in JCL to call super and then do
what releaseLocks() currently does. Note that Module.classLoaderDown() already
calls PCL.destroy(), so that should do what you want.
(I don't really remember why I didn't release locks in classLoaderDown to begin
with, but see if it works again.)
BTW when making a patch, it is more readable to delete lines than to comment
Thanks for cue. It works for me now in any manner.
Checking in core/bootstrap/src/org/netbeans/Module.java;
/cvs/core/bootstrap/src/org/netbeans/Module.java,v <-- Module.java
new revision: 1.2; previous revision: 1.1
Checking in core/bootstrap/src/org/netbeans/JarClassLoader.java;
/cvs/core/bootstrap/src/org/netbeans/JarClassLoader.java,v <-- JarClassLoader.java
new revision: 1.18; previous revision: 1.17
Marking this issue as VERIFIED since the issue reporter == issue owner.