8033425: Delay loading of net library in PortConfig initialization (workaround for for 8033367)
authormichaelm
Mon, 03 Feb 2014 14:40:28 +0000
changeset 22633 303b60d0f31a
parent 22632 4953e3d7f07e
child 22634 9c18aebe9229
8033425: Delay loading of net library in PortConfig initialization (workaround for for 8033367) Reviewed-by: alanb, chegar
jdk/src/share/classes/java/net/SocketPermission.java
--- a/jdk/src/share/classes/java/net/SocketPermission.java	Mon Feb 03 14:18:45 2014 +0000
+++ b/jdk/src/share/classes/java/net/SocketPermission.java	Mon Feb 03 14:40:28 2014 +0000
@@ -235,13 +235,11 @@
     private static Debug debug = null;
     private static boolean debugInit = false;
 
-    // ephemeral port range for this system
-    private static final int ephemeralLow = initEphemeralPorts(
-        "low", DEF_EPH_LOW
-    );
-    private static final int ephemeralHigh = initEphemeralPorts(
-        "high", PORT_MAX
-    );
+    // lazy initializer
+    private static class EphemeralRange {
+        static final int low = initEphemeralPorts("low", DEF_EPH_LOW);
+            static final int high = initEphemeralPorts("high", PORT_MAX);
+    };
 
     static {
         Boolean tmp = java.security.AccessController.doPrivileged(
@@ -1235,6 +1233,9 @@
         int policyLow, int policyHigh, int targetLow, int targetHigh
     )
     {
+        final int ephemeralLow = EphemeralRange.low;
+        final int ephemeralHigh = EphemeralRange.high;
+
         if (targetLow == 0) {
             // check policy includes ephemeral range
             if (!inRange(policyLow, policyHigh, ephemeralLow, ephemeralHigh)) {