Search code examples
netbeansdeadlockgui-builder

NetBeans IDE deadlock


I've already gone to the NetBeans bug reporting community, before anyone points me there. They have no solution.

In every NetBeans IDE I use (I have 4 versions (6.9, 6.9.1, 7.0, and the latest experimental build) on multiple computers), they consistently and predictably go into deadlock whenever I open the GUI builder for a class (JFrame, JDialog, and Panel), unless it is the first time that class' GUI builder has been opened. Has anyone else encountered this problem? If so, have you found a way to fix it?

Reason


I discovered the reason, but still have no solution: There is a new thread started within my library's class BHFrame's initComponents() method, which extends JFrame and uses the NetBeans GUI Builder. NetBeans tries to run this method when trying to build the GUI in the builder, and locks up in an infinite loop of waiting. NetBeans reports this during Thread Dumping:

Found one Java-level deadlock:
=============================
"BHFrame.initComponents():  Setting up custColorsEditDialog":
  waiting to lock monitor 0x089178d4 (object 0x1ae148f8, a
javax.swing.MultiUIDefaults),
  which is held by "AWT-EventQueue-1"
"AWT-EventQueue-1":
  waiting to lock monitor 0x0868f6ec (object 0x1a310f18, a
java.awt.Component$AWTTreeLock),
  which is held by "BHFrame.initComponents():  Setting up custColorsEditDialog"

Solution

  • I deleted the new thread spawned in the initComponents() method, and after a while, everything is back to normal.