jtulach commented on code in PR #5609:
URL: https://github.com/apache/netbeans/pull/5609#discussion_r1141263003


##########
nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java:
##########
@@ -252,4 +276,144 @@ private static boolean isIgnored(
         return false;
     }
 
+    private static final class NbJavacLoader extends URLClassLoader {
+        private static final String MAIN_COMPILER_CP = "nbjavac.class.path";
+        private static final String MAIN_COMPILER_CLASS = 
"com.sun.tools.javac.Main";
+        private final Map<String, Class<?>> priorityLoaded;
+
+        private NbJavacLoader(URL[] urls, ClassLoader parent) {
+            super(urls, parent);
+            this.priorityLoaded = new HashMap<>();

Review Comment:
   > accessing the HashMap in a potentially racy fashion.
   
   Do you mean the `HashMap` behind `Properties`? `Properties` is an ancient 
class and it extends `Hashtable` which is `synchronized`.
   
   Or do you mean some other race condition that would load the `nb-javac` 
classes more than once? If so, then it shouldn't be a problem. The 
`CustomJavac` task works when loading the classes multiple times - it's just 
slow, so we want to cache it and not load it thousand times. As soon as the 
`Class` lands in global properties, any compilation that happens 1s later will 
pick it up. That shall be good enough.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to