JaroslavTulach commented on a change in pull request #1092: Using Scripting API 
in platform/core.network
URL: 
https://github.com/apache/incubator-netbeans/pull/1092#discussion_r249408208
 
 

 ##########
 File path: 
platform/core.network/src/org/netbeans/core/network/utils/IpAddressUtils.java
 ##########
 @@ -52,7 +53,18 @@
     private static final Pattern IPV4_PATTERN = 
Pattern.compile("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$");
     private static final RequestProcessor RP = new 
RequestProcessor("DNSBackgroundResolvers", 10);
 
-    private IpAddressUtils() {}
+    IpAddressUtils() {}
+
+    private static IpAddressUtils INSTANCE;
+    private static synchronized IpAddressUtils getDefault() {
+        if (INSTANCE == null) {
+            INSTANCE = Lookup.getDefault().lookup(IpAddressUtils.class);
 
 Review comment:
   This makes `IpAddressUtils` mockable and thus it avoids the reflection based 
tricks with `NameService` that are broken on JDK11.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
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