changeset 9225:15286183e29b

8033425: Delay loading of net library in PortConfig initialization (workaround for for 8033367) Reviewed-by: alanb, chegar
author michaelm
date Mon, 03 Feb 2014 14:40:28 +0000
parents 79745e1148c0
children dfbdedea8518
files src/share/classes/java/net/SocketPermission.java
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/net/SocketPermission.java	Mon Feb 03 14:18:45 2014 +0000
+++ b/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)) {