/** * Instantiate the reloading class loader */ public ReloadingWicketFilter() { // Create a reloading classloader reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); }
Class<?> clazz = findLoadedClass(name); final ClassLoader parent = getParent(); if (tryClassHere(name)) clazz = findClass(name); watchForModifications(clazz); resolveClass(clazz);
/** * Gets a resource from this <code>ClassLoader</class>. If the * resource does not exist in this one, we check the parent. * Please note that this is the exact opposite of the * <code>ClassLoader</code> spec. We use it to work around inconsistent class loaders from third * party vendors. * * @param name * of resource */ @Override public final URL getResource(final String name) { URL resource = findResource(name); ClassLoader parent = getParent(); if (resource == null && parent != null) { resource = parent.getResource(name); } return resource; }
/** * Create a new reloading ClassLoader from a list of URLs, and initialize the * ModificationWatcher to detect class file modifications * * @param parent * the parent classloader in case the class file cannot be loaded from the above * locations */ public ReloadingClassLoader(ClassLoader parent) { super(new URL[] { }, parent); // probably doubles from this class, but just in case addClassLoaderUrls(parent); for (Iterator<URL> iter = urls.iterator(); iter.hasNext();) { addURL(iter.next()); } watcher = new ModificationWatcher(pollFrequency); }
public void onChange() { // Remove the ModificationWatcher from the current reloading class loader reloadingClassLoader.destroy(); /* * Create a new classloader, as there is no way to clear a ClassLoader's cache. This * supposes that we don't share objects across application instances, this is almost * true, except for Wicket's Session object. */ reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try { init(filterConfig); } catch (ServletException e) { throw new RuntimeException(e); } } });
throws ServletException reloadingClassLoader.setListener(new IChangeListener<Class<?>>() reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try
/** * Add all the url locations we can find for the provided class loader * * @param loader * class loader */ private static void addClassLoaderUrls(ClassLoader loader) { if (loader != null) { final Enumeration<URL> resources; try { resources = loader.getResources(""); } catch (IOException e) { throw new RuntimeException(e); } while (resources.hasMoreElements()) { URL location = resources.nextElement(); ReloadingClassLoader.addLocation(location); } } }
/** * Create a new reloading ClassLoader from a list of URLs, and initialize the * ModificationWatcher to detect class file modifications * * @param parent * the parent classloader in case the class file cannot be loaded from the above * locations */ public ReloadingClassLoader(ClassLoader parent) { super(new URL[] {}, parent); // probably doubles from this class, but just in case addClassLoaderUrls(parent); for (Iterator i = urls.iterator(); i.hasNext();) { addURL((URL)i.next()); } watcher = new ModificationWatcher(pollFrequency); }
public void onChange() { // Remove the ModificationWatcher from the current reloading class loader reloadingClassLoader.destroy(); /* * Create a new classloader, as there is no way to clear a ClassLoader's cache. This * supposes that we don't share objects across application instances, this is almost * true, except for Wicket's Session object. */ reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try { init(filterConfig); } catch (ServletException e) { throw new RuntimeException(e); } } });
reloadingClassLoader.setListener(new IChangeListener() reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try
/** * Add all the url locations we can find for the provided class loader * * @param loader * class loader */ private static void addClassLoaderUrls(ClassLoader loader) { if (loader != null) { final Enumeration<URL> resources; try { resources = loader.getResources(""); } catch (IOException e) { throw new RuntimeException(e); } while (resources.hasMoreElements()) { URL location = resources.nextElement(); ReloadingClassLoader.addLocation(location); } } }
Class clazz = findLoadedClass(name); final ClassLoader parent = getParent(); if (tryClassHere(name)) clazz = findClass(name); watchForModifications(clazz); resolveClass(clazz);
/** * Create a new reloading ClassLoader from a list of URLs, and initialize the * ModificationWatcher to detect class file modifications * * @param parent * the parent classloader in case the class file cannot be loaded from the above * locations */ public ReloadingClassLoader(ClassLoader parent) { super(new URL[] { }, parent); // probably doubles from this class, but just in case addClassLoaderUrls(parent); for (URL url : urls) { addURL(url); } Duration pollFrequency = Duration.seconds(3); watcher = new ModificationWatcher(pollFrequency); }
/** * Gets a resource from this <code>ClassLoader</class>. If the * resource does not exist in this one, we check the parent. * Please note that this is the exact opposite of the * <code>ClassLoader</code> spec. We use it to work around * inconsistent class loaders from third party vendors. * * @param name of resource */ public final URL getResource(final String name) { URL resource = findResource(name); ClassLoader parent = getParent(); if (resource == null && parent != null) { resource = parent.getResource(name); } return resource; }
@Override public void onChange(Class<?> clz) { destroy(); // Remove the ModificationWatcher from the current reloading class loader reloadingClassLoader.destroy(); /* * Create a new classloader, as there is no way to clear a ClassLoader's cache. This * supposes that we don't share objects across application instances, this is almost * true, except for Wicket's Session object. */ reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try { init(filterConfig); } catch (ServletException e) { throw new RuntimeException(e); } } });
throws ServletException reloadingClassLoader.setListener(new IChangeListener<Class<?>>() reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); try
/** * Instantiate the reloading class loader */ public ReloadingWicketFilter() { // Create a reloading classloader reloadingClassLoader = new ReloadingClassLoader(getClass().getClassLoader()); }
/** * Add all the url locations we can find for the provided class loader * * @param loader * class loader */ private static void addClassLoaderUrls(ClassLoader loader) { if (loader != null) { final Enumeration resources; try { resources = loader.getResources(""); } catch (IOException e) { throw new RuntimeException(e); } while (resources.hasMoreElements()) { URL location = (URL)resources.nextElement(); ReloadingClassLoader.addLocation(location); } } }
Class<?> clazz = findLoadedClass(name); final ClassLoader parent = getParent(); if (tryClassHere(name)) clazz = findClass(name); watchForModifications(clazz); resolveClass(clazz);
/** * Create a new reloading ClassLoader from a list of URLs, and initialize the * ModificationWatcher to detect class file modifications * * @param parent * the parent classloader in case the class file cannot be loaded from the above * locations */ public ReloadingClassLoader(ClassLoader parent) { super(new URL[] { }, parent); // probably doubles from this class, but just in case addClassLoaderUrls(parent); for (URL url : urls) { addURL(url); } Duration pollFrequency = Duration.seconds(3); watcher = new ModificationWatcher(pollFrequency); }