--- old/src/java.base/share/classes/java/lang/ClassLoader.java 2019-10-06 15:46:27.313926780 +0300 +++ new/src/java.base/share/classes/java/lang/ClassLoader.java 2019-10-06 15:46:27.083926790 +0300 @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016-2019, Azul Systems, Inc. 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 @@ -2473,8 +2474,7 @@ * * We use a static stack to hold the list of libraries we are * loading because this can happen only when called by the - * same thread because Runtime.load and Runtime.loadLibrary - * are synchronous. + * same thread because this block is synchronous. * * If there is a pending load operation for the library, we * immediately return success; otherwise, we raise @@ -2620,8 +2620,12 @@ ClassLoader loader = (fromClass == null) ? null : fromClass.getClassLoader(); if (sys_paths == null) { - usr_paths = initializePath("java.library.path"); - sys_paths = initializePath("sun.boot.library.path"); + synchronized (ClassLoader.class) { + if (sys_paths == null) { + usr_paths = initializePath("java.library.path"); + sys_paths = initializePath("sun.boot.library.path"); + } + } } if (isAbsolute) { if (loadLibrary0(fromClass, new File(name))) {