diff --git a/src/share/classes/sun/misc/Launcher.java b/src/share/classes/sun/misc/Launcher.java index a5d4b7270fe7fa80f789ede862177defcb826cbb..aab19516650d326d3fb38a6bde6a4ac11b502e2d 100644 --- a/src/share/classes/sun/misc/Launcher.java +++ b/src/share/classes/sun/misc/Launcher.java @@ -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 @@ import sun.net.www.ParseUtil; /** * 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 @@ public class Launcher { static { ClassLoader.registerAsParallelCapable(); } + private static volatile ExtClassLoader instance = null; /** * create an ExtClassLoader. The ExtClassLoader is created @@ -128,6 +129,17 @@ public class Launcher { */ 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