Created attachment 123316 [details]
Tried to remove a dep
47bac66aa192. Seems if I have a POM open in the editor, making additions or removals in the Dependencies node is more likely than not to result in a deadlock.
Created attachment 123317 [details]
A couple minutes before, when adding a dep
I believe the fix http://hg.netbeans.org/main/rev/3dfb067533e2 it completely flawed.
At least according to the xam/xdm documentation isInTransaction() means that some other thread holds the lock and is in transaction. But that has no relationship to the current thread whatsoever. The lock only applies to the thread that started the transaction. The transaction could be ended right after this check. or in the middle of it.. but we still query the model from the other thread.
I suggest we remove these checks and just acquire the transaction, or not even bother since transactions are supposedly to be started only for mutations, which we don't do in the StatusProvider.
also please note that model.synch() which is called by StatusProvider.checkModelValid() will in it's body start a blocking transaction.
to solve this problem I suggest 2 solutions (should be aplied together, not mutually exclusive):
1. Utilities.performPOMModelOperations() will wrap the xam transaction in ((BaseDocument)model.getBaseDocument()).runAtomicAsUser(Runnable) to have the document locked first.
2. in status provider, remove all the transaction related code and just read the models.
but I also filed issue 217234 to finally create order in the way threading is done with the xam pom models.
*** Bug 216978 has been marked as a duplicate of this bug. ***
Integrated into 'main-golden', will be available in build *201208231248* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Milos Kleint <email@example.com>
Log: #217111 post code to RP thread to avoid document lock in awt