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.
The javadoc of postWriteAccess says: "Run an action with write access as soon as that is permitted." but a test that I have added into test/unit/src/org/openide/util/MutexTest shows that it does not. Please fix that behaviour and also apply the same for postReadAccess. PS: the tests begin with Xtest not to break the test suite, delete the X when you fix the problem.
I have taken a look at that. It seems to me that first "fail"s in both tests are right. Mutex was written with that intention in mind. I have a simple fix for that. Second "fail"s are more problematic since I do not have fix for them, in fact I think that I would need to rewrite some parts this very critical class. So, I suggest to fix only first "fail"s and do not fix the second. Maybe this is reasonable, since even though the requests are run later, they see coherent state.
Yes, the second fail is more problematic, but I guess that following code: // no MUTEX access around this code MUTEX.readAccess () { MUTEX.postWriteAccess () { doSomething (); } } expectSomehtingIsDone (); should behave in the same way as: MUTEX.writeAccess () { MUTEX.readAccess () { MUTEX.postWriteAccess () { doSomething (); } } expectThatSomethingHasBeenDone (); } This might be crusial for Children.Keys that calls the setKeys in MUTEX.postWriteAccess and it might happen that somebody asking for writeAccess would not see modifications done by somebody else immediatelly (as shown in the previous cases) which is probably wrong.
Basically, I fixed this bug so that the tests, plus bunch of others, are passing now. Unfortunately, I saw this lock, likely caused by an incosistent state of the Mutex:"OpenIDE Request Processor-0" daemon prio=1 tid=0x1b0580 nid=0xd waiting on monitor [0xf2b81000..0xf2b819e0] at java.lang.Object.wait(Native Method) at org.openide.util.Mutex$QueueCell.sleep(Mutex.java:1145) at org.openide.util.Mutex.enter(Mutex.java:475) at org.openide.util.Mutex.postRequest(Mutex.java:853) at org.openide.util.Mutex.postWriteRequest(Mutex.java:368) at org.openide.nodes.Children$Keys.applyKeys(Children.java:1721) at org.openide.nodes.Children$Keys.setKeys(Children.java:1680) at org.openide.loaders.FolderChildren.setKeys0(FolderChildren.java:229) at org.openide.loaders.FolderChildren.access$300(FolderChildren.java:35) at org.openide.loaders.FolderChildren$Addition.run(FolderChildren.java:375) at org.openide.util.Task.run(Task.java:152) at org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:611)
Fixed in main trunk. I extended the tests as well.
Resolved for 3.4.x or earlier, no new info since then -> verified
Resolved for 3.4.x or earlier, no new info since then -> closing.