-BeanNode
+BeanNode
obviously depends on reflection to get values of beans
properties, which shouldn't be considered lack of API. Same
applyies to
PropertySupport and
-IndexedPropertySupport.
+IndexedPropertySupport.
+A test in Children checks that
+org.netbeans.api.project.ProjectManager.mutex()
is not held by the current
+thread when acquiring Children.MUTEX.
+Since this module cannot depend on the module providing ProjectManager
,
+the test uses reflection to retrieve the ProjectManager.mutex()
instance.
diff --git a/openide.nodes/src/org/openide/nodes/Children.java b/openide.nodes/src/org/openide/nodes/Children.java
--- a/openide.nodes/src/org/openide/nodes/Children.java
+++ b/openide.nodes/src/org/openide/nodes/Children.java
@@ -41,6 +41,9 @@
package org.openide.nodes;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -52,6 +55,8 @@
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Logger;
import org.openide.util.Enumerations;
import org.openide.util.Mutex;
@@ -91,7 +96,7 @@
* needs for a certain amount of time to forbid modification,
* he can execute his code in {@link Mutex#readAccess}.
*/
- public static final Mutex MUTEX = new Mutex(PR);
+ public static final Mutex MUTEX = new Mutex(PR, new ProjectManagerDeadlockDetector());
/** The object representing an empty set of children. Should
* be used to represent the children of leaf nodes. The same
@@ -1755,4 +1760,61 @@
});
}
*/
+
+ private static final class ProjectManagerDeadlockDetector implements Executor {
+
+ private final AtomicReference