This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61028

Summary: Release locks on disabled module's jar
Product: platform Reporter: Jiri Rechtacek <jrechtacek>
Component: Module SystemAssignee: Jiri Rechtacek <jrechtacek>
Status: VERIFIED FIXED    
Severity: blocker CC: jglick
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 20323    
Attachments: implementation draft #1

Description Jiri Rechtacek 2005-07-15 13:15:26 UTC
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.
Comment 1 Jiri Rechtacek 2005-07-15 13:16:28 UTC
Blocks Uninstall feature (issue 20323) on Windows OS.
Comment 2 Jesse Glick 2005-07-15 15:34:51 UTC
Please also enhance ModuleManagerTest.testModuleDeletion to check that it works.
Comment 3 Jiri Rechtacek 2005-07-19 17:28:43 UTC
Created attachment 23161 [details]
implementation draft #1
Comment 4 Jiri Rechtacek 2005-07-19 17:36:07 UTC
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
Comment 5 Jesse Glick 2005-07-19 18:38:25 UTC
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
them out.
Comment 6 Jiri Rechtacek 2005-07-20 14:34:52 UTC
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
done
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
done
Comment 7 Jaromir Uhrik 2006-01-16 15:45:40 UTC
Marking this issue as VERIFIED since the issue reporter == issue owner.