Merge branch '1.5.x'

pull/12202/head
Andy Wilkinson 7 years ago
commit 73ad36d817

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -138,19 +138,21 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad
if (file != null && file.getKind() == Kind.DELETED) { if (file != null && file.getKind() == Kind.DELETED) {
throw new ClassNotFoundException(name); throw new ClassNotFoundException(name);
} }
Class<?> loadedClass = findLoadedClass(name); synchronized (getClassLoadingLock(name)) {
if (loadedClass == null) { Class<?> loadedClass = findLoadedClass(name);
try { if (loadedClass == null) {
loadedClass = findClass(name); try {
loadedClass = findClass(name);
}
catch (ClassNotFoundException ex) {
loadedClass = getParent().loadClass(name);
}
} }
catch (ClassNotFoundException ex) { if (resolve) {
loadedClass = getParent().loadClass(name); resolveClass(loadedClass);
} }
return loadedClass;
} }
if (resolve) {
resolveClass(loadedClass);
}
return loadedClass;
} }
@Override @Override

Loading…
Cancel
Save