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.
Just received the warning about the mutex in o.o.nodes.Children going from read to write access (see the attached stack trace). Seems caused by the Server Resources node, which is a FilterNode which filters either the "setup" directory in a J2EE project, or an AbstractNode (when this directory doesn't exist) and uses FN.changeOriginal() to switch among the two. Here the SRN constructor is called under Children.MUTEX read access and triggers the changeOriginal() method call, which needs write access. Not sure whose issue this is (ServerResourcesNode or FilterNode). Should FilterNode clients be aware that they should not call FN.changeOriginal() under Children.MUTEX read lock? If so, how would they find this out?
Created attachment 24944 [details] Stack trace
They could recognize this using mutex methods is[Read|Write]Access, but that's not nice. Probably the FilterNode should perform changeOriginal from inside a postWriteRequest, instead of plain writeAccess.
Guys, read the javadoc of the changeOriginal method. The only one who has to do postWriteRequest is its caller...
There doesn't to be anything in the Javadoc of FilterNode.changeOriginal() suggesting that I should call postWriteAccess(). And the word mutex isn't mentioned in the whole FN's Javadoc, so how does a user know that it's Children.MUTEX? Jardo, could you please elaborate a bit on this?
Sorry, the warning was only in FilterChildren.changeXXX "#64665: Improving javadoc to mention that Children.MUTEX.writeAccess is needed if changing children" Checking in src/org/openide/nodes/FilterNode.java; /cvs/openide/nodes/src/org/openide/nodes/FilterNode.java,v <-- FilterNode.java new revision: 1.2; previous revision: 1.1 done Checking in src/org/openide/util/actions/NodeAction.java; /cvs/openide/nodes/src/org/openide/util/actions/NodeAction.java,v <-- NodeAction.java new revision: 1.8; previous revision: 1.7
Jardo, not meaning to be picky, but the added Javadoc comment suggests that the caller should only pay attention to the Children.MUTEX write lock if he also changes the children. But FN.changeOriginal() *always* aquires the write lock, regardless of the changeChildren parameter value.
Fixed. Checking in ServerResourceNode.java; /cvs/j2ee/ejbapi/src/org/netbeans/modules/j2ee/ejbjar/project/ui/ServerResourceNode.java,v <-- ServerResourceNode.java new revision: 1.2; previous revision: 1.1 done