Skip to content

Commit 73ad36d

Browse files
committed
Merge branch '1.5.x'
2 parents 782ab28 + 1468585 commit 73ad36d

File tree

1 file changed

+13
-11
lines changed
  • spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader

1 file changed

+13
-11
lines changed

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -138,19 +138,21 @@ public Class<?> loadClass(String name, boolean resolve)
138138
if (file != null && file.getKind() == Kind.DELETED) {
139139
throw new ClassNotFoundException(name);
140140
}
141-
Class<?> loadedClass = findLoadedClass(name);
142-
if (loadedClass == null) {
143-
try {
144-
loadedClass = findClass(name);
141+
synchronized (getClassLoadingLock(name)) {
142+
Class<?> loadedClass = findLoadedClass(name);
143+
if (loadedClass == null) {
144+
try {
145+
loadedClass = findClass(name);
146+
}
147+
catch (ClassNotFoundException ex) {
148+
loadedClass = getParent().loadClass(name);
149+
}
145150
}
146-
catch (ClassNotFoundException ex) {
147-
loadedClass = getParent().loadClass(name);
151+
if (resolve) {
152+
resolveClass(loadedClass);
148153
}
154+
return loadedClass;
149155
}
150-
if (resolve) {
151-
resolveClass(loadedClass);
152-
}
153-
return loadedClass;
154156
}
155157

156158
@Override

0 commit comments

Comments
 (0)