Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 169815 - Module system events delivered sooner than initialization is finished
Module system events delivered sooner than initialization is finished
Product: platform
Classification: Unclassified
Component: Module System
All All
: P3 (vote)
Assigned To: Jesse Glick
Depends on:
  Show dependency treegraph
Reported: 2009-08-04 12:41 UTC by Jaroslav Tulach
Modified: 2009-08-04 23:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2009-08-04 12:41:29 UTC
Once Jesse expressed a worry that some pieces of module code can be triggered sooner than the module initialization is 
over. The original suspect was Module.firePropertyChange, however there is another possible problem. As issue 159714 
shows, module system can deliver lookup notifications while holding the ModuleManager lock. See
and especially:
	- locked <0x00007f18a4e04b28> (a java.util.HashMap)
	at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.openide.util.WeakListenerImpl$ProxyListener.invoke(
	at $Proxy2.resultChanged(Unknown Source)
	at org.openide.util.lookup.ProxyLookup$
	at org.openide.util.lookup.ProxyLookup.setLookups(
	at org.openide.util.lookup.ProxyLookup.setLookups(
	at org.netbeans.core.startup.MainLookup.moduleClassLoadersUp(
	at org.netbeans.core.startup.MainLookup.systemClassLoaderChanged(
	at org.netbeans.core.startup.NbInstaller.load(
	at org.netbeans.ModuleManager.enable(
I am not sure how big problem this is, but if it is possible source of bugs, then the lookup can be instructed to 
delay the delivery of events until ModuleManager leaves its lock via ProxyLookup.setLookup(deliveryExecutor, arr).
Comment 1 Jesse Glick 2009-08-04 23:42:27 UTC
The MM lock is acquired in this case by From the module system there is no
telling when it would be released, so deferring notification until the lock is released is not going to work
(synchronous observers would see the new contents of lookup before the event); and delivering notifications
asynchronously would be incompatible and possibly lead to race conditions and randomly failing tests.

Anyway the module system's lock does not seem to have been involved in the deadlock mentioned.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo