changeset 13422:9cf14f22734a jdk8u171-b07

8191909: Nightly failures in nashorn suite Reviewed-by: chegar
author robm
date Tue, 20 Feb 2018 14:00:02 +0000
parents 17905e00cda4
children 0bafb5654e0c
files src/share/classes/sun/misc/Launcher.java
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/misc/Launcher.java	Fri Feb 16 01:37:10 2018 -0800
+++ b/src/share/classes/sun/misc/Launcher.java	Tue Feb 20 14:00:02 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
 
 /**
  * This class is used by the system to launch the main application.
-Launcher */
+ */
 public class Launcher {
     private static URLStreamHandlerFactory factory = new Factory();
     private static Launcher launcher = new Launcher();
@@ -121,6 +121,7 @@
         static {
             ClassLoader.registerAsParallelCapable();
         }
+        private static volatile ExtClassLoader instance = null;
 
         /**
          * create an ExtClassLoader. The ExtClassLoader is created
@@ -128,6 +129,17 @@
          */
         public static ExtClassLoader getExtClassLoader() throws IOException
         {
+            if (instance == null) {
+                synchronized(ExtClassLoader.class) {
+                    if (instance == null) {
+                        instance = createExtClassLoader();
+                    }
+                }
+            }
+            return instance;
+        }
+
+        private static ExtClassLoader createExtClassLoader() throws IOException {
             try {
                 // Prior implementations of this doPrivileged() block supplied
                 // aa synthesized ACC via a call to the private method