1

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"
Ky -
  • 30,724
  • 51
  • 192
  • 308
  • does it ever come out of deadlock? I know you said that you'd already looked at the NB bug list, but have a look if this [bug report](http://netbeans.org/bugzilla/show_bug.cgi?id=197675) helps you – Tim Sparg Apr 18 '11 at 14:36
  • It does not, hence the term "Deadlock". I even left it running for a day and a half, once. It was still frozen. - Also, LOL look at the email of the user who submitted it. That's me. – Ky - Apr 18 '11 at 19:34
  • So let me get this straight, the GUI builder calls your library class, which spawns a thread and calls the GUI builder? I'm not really surprised that that causes a deadlock, if that's the case. – Robin Green Apr 18 '11 at 21:56
  • It appears that when it starts the GUI builder, it looks into the `initComponents()` method of my `BHFrame` class, and tries to run that. Within this method, there is a new thread (named `BHFrame.initComponents(): Setting up custColorsEditDialog`), and it tells the thread `AWT-EventQueue-1` to wait for the `BHFrame.initComponents(): Setting up custColorsEditDialog` thread to complete, which in turn waits for the `AWT-EventQueue-1` thread to complete, and they get stuck in deadlock. NetBeans will not respond until the threads both complete, and ends up deadlocking. – Ky - Apr 19 '11 at 00:12

1 Answers1

0

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

Ky -
  • 30,724
  • 51
  • 192
  • 308