Java 类org.springframework.boot.devtools.restart.classloader.RestartClassLoader 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Restarter.java   
private void clear(Class<?> type, String fieldName) throws Exception {
    Field field = type.getDeclaredField(fieldName);
    field.setAccessible(true);
    Object instance = field.get(null);
    if (instance instanceof Set) {
        ((Set<?>) instance).clear();
    }
    if (instance instanceof Map) {
        Map<?, ?> map = ((Map<?, ?>) instance);
        for (Iterator<?> iterator = map.keySet().iterator(); iterator.hasNext();) {
            Object value = iterator.next();
            if (value instanceof Class && ((Class<?>) value)
                    .getClassLoader() instanceof RestartClassLoader) {
                iterator.remove();
            }

        }
    }
}
项目:spring-boot-concourse    文件:Restarter.java   
private void clear(Class<?> type, String fieldName) throws Exception {
    Field field = type.getDeclaredField(fieldName);
    field.setAccessible(true);
    Object instance = field.get(null);
    if (instance instanceof Set) {
        ((Set<?>) instance).clear();
    }
    if (instance instanceof Map) {
        Map<?, ?> map = ((Map<?, ?>) instance);
        for (Iterator<?> iterator = map.keySet().iterator(); iterator.hasNext();) {
            Object value = iterator.next();
            if (value instanceof Class && ((Class<?>) value)
                    .getClassLoader() instanceof RestartClassLoader) {
                iterator.remove();
            }

        }
    }
}
项目:contestparser    文件:Restarter.java   
private void clear(Class<?> type, String fieldName) throws Exception {
    Field field = type.getDeclaredField(fieldName);
    field.setAccessible(true);
    Object instance = field.get(null);
    if (instance instanceof Set) {
        ((Set<?>) instance).clear();
    }
    if (instance instanceof Map) {
        Map<?, ?> map = ((Map<?, ?>) instance);
        for (Iterator<?> iterator = map.keySet().iterator(); iterator.hasNext();) {
            Object value = iterator.next();
            if (value instanceof Class && ((Class<?>) value)
                    .getClassLoader() instanceof RestartClassLoader) {
                iterator.remove();
            }

        }
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Restarter.java   
private Throwable doStart() throws Exception {
    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()]);
    ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles);
    ClassLoader classLoader = new RestartClassLoader(parent, urls, updatedFiles,
            this.logger);
    if (this.logger.isDebugEnabled()) {
        this.logger.debug("Starting application " + this.mainClassName + " with URLs "
                + Arrays.asList(urls));
    }
    return relaunch(classLoader);
}
项目:spring-boot-concourse    文件:Restarter.java   
private Throwable doStart() throws Exception {
    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()]);
    ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles);
    ClassLoader classLoader = new RestartClassLoader(parent, urls, updatedFiles,
            this.logger);
    if (this.logger.isDebugEnabled()) {
        this.logger.debug("Starting application " + this.mainClassName + " with URLs "
                + Arrays.asList(urls));
    }
    return relaunch(classLoader);
}
项目:contestparser    文件:Restarter.java   
private Throwable doStart() throws Exception {
    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()]);
    ClassLoaderFiles updatedFiles = new ClassLoaderFiles(this.classLoaderFiles);
    ClassLoader classLoader = new RestartClassLoader(parent, urls, updatedFiles,
            this.logger);
    if (this.logger.isDebugEnabled()) {
        this.logger.debug("Starting application " + this.mainClassName + " with URLs "
                + Arrays.asList(urls));
    }
    return relaunch(classLoader);
}