Commit d6fe4b9a authored by Stephane Nicoll's avatar Stephane Nicoll

Polish

parent e5361d88
...@@ -23,7 +23,6 @@ import java.net.URL; ...@@ -23,7 +23,6 @@ import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
...@@ -273,11 +272,10 @@ public class Restarter { ...@@ -273,11 +272,10 @@ public class Restarter {
private Throwable doStart() throws Exception { private Throwable doStart() throws Exception {
Assert.notNull(this.mainClassName, "Unable to find the main class to restart"); Assert.notNull(this.mainClassName, "Unable to find the main class to restart");
ClassLoader parent = this.applicationClassLoader;
URL[] urls = this.urls.toArray(new URL[this.urls.size()]); URL[] urls = this.urls.toArray(new URL[this.urls.size()]);
ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles); ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles);
ClassLoader classLoader = new RestartClassLoader(parent, urls, updatedFiles, ClassLoader classLoader = new RestartClassLoader(this.applicationClassLoader,
this.logger); urls, updatedFiles, this.logger);
if (this.logger.isDebugEnabled()) { if (this.logger.isDebugEnabled()) {
this.logger.debug("Starting application " + this.mainClassName + " with URLs " this.logger.debug("Starting application " + this.mainClassName + " with URLs "
+ Arrays.asList(urls)); + Arrays.asList(urls));
...@@ -361,14 +359,8 @@ public class Restarter { ...@@ -361,14 +359,8 @@ public class Restarter {
} }
if (instance instanceof Map) { if (instance instanceof Map) {
Map<?, ?> map = ((Map<?, ?>) instance); Map<?, ?> map = ((Map<?, ?>) instance);
for (Iterator<?> iterator = map.keySet().iterator(); iterator.hasNext();) { map.keySet().removeIf(value -> value instanceof Class && ((Class<?>) value)
Object value = iterator.next(); .getClassLoader() instanceof RestartClassLoader);
if (value instanceof Class && ((Class<?>) value)
.getClassLoader() instanceof RestartClassLoader) {
iterator.remove();
}
}
} }
} }
...@@ -505,7 +497,7 @@ public class Restarter { ...@@ -505,7 +497,7 @@ public class Restarter {
/** /**
* Initialize restart support. See * Initialize restart support. See
* {@link #initialize(String[], boolean, RestartInitializer)} for details. * {@link #initialize(String[], boolean, RestartInitializer, boolean)} for details.
* @param args main application arguments * @param args main application arguments
* @param forceReferenceCleanup if forcing of soft/weak reference should happen on * @param forceReferenceCleanup if forcing of soft/weak reference should happen on
* @param initializer the restart initializer * @param initializer the restart initializer
...@@ -559,7 +551,7 @@ public class Restarter { ...@@ -559,7 +551,7 @@ public class Restarter {
* Set the restarter instance (useful for testing). * Set the restarter instance (useful for testing).
* @param instance the instance to set * @param instance the instance to set
*/ */
final static void setInstance(Restarter instance) { static void setInstance(Restarter instance) {
synchronized (INSTANCE_MONITOR) { synchronized (INSTANCE_MONITOR) {
Restarter.instance = instance; Restarter.instance = instance;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment