public static void checkAndClose(ClassLoader classLoader) { if (!isWindows() || !(classLoader instanceof URLClassLoader)) { return; } HashSet<String> leakedJarNames = preClose((URLClassLoader)classLoader); cleanupJarFileFactory(leakedJarNames); }
private static HashSet<String> preClose(URLClassLoader loader) Field f = getClassField(URLClassLoader.class, "ucp"); if (f != null) f = getClassField(ucp.getClass(), "loaders"); if (f != null) f = getClassField(obj.getClass(), "jar"); if (f != null)
/** * Removes a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) * functionality. * * Removing a handler, even when null, or non-existing, might have side-effects as introduced by the Jetty * implementation. At the time of writing, Jetty will re * * @param handler The handler (should not be null). */ public void removeJettyHandler( Handler handler ) { if (handler instanceof WebAppContext) { // A work-around of the Jetty bug described at https://github.com/eclipse/jetty.project/issues/1425 // NOTE: According to some comments on WebAppLoaderFix, this may stop working on Java 9. // Hopefully the Jetty team will have fixed the underlying bug by then WebAppLoaderFix.checkAndClose(((WebAppContext) handler).getClassLoader()); } extensionHandlers.removeHandler( handler ); if ( handler.isStarted() ) { try { handler.stop(); } catch ( Exception e ) { Log.warn( "Unable to stop the handler that was removed: {}", handler, e ); } } }
Field f = getClassField(classJarURLConnection, "factory"); f = getClassField(classJarFileFactory, "fileCache"); if (f == null) f = getClassField(classJarFileFactory, "urlCache"); if (f == null)