public void clearHandlers() { HandlerCollection hc = (HandlerCollection) jetty.getHandler(); Handler[] ha = hc.getHandlers(); if (ha != null) { for (Handler h : ha) { hc.removeHandler(h); } } }
/** * 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 ); } } }
@Override public void removeHandler(Handler handler) { server.getRootHandlerCollection().removeHandler(handler); }
public void clearHandlers() { HandlerCollection hc = (HandlerCollection) jetty.getHandler(); Handler[] ha = hc.getHandlers(); if (ha != null) { for (Handler h : ha) { hc.removeHandler(h); } } }
/** * 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 ) { extensionHandlers.removeHandler( handler ); if ( handler.isStarted() ) { try { handler.stop(); } catch ( Exception e ) { Log.warn( "Unable to stop the handler that was removed: {}", handler, e ); } } }
void stop() { if (server == null) { return; } jqmlogger.trace("Jetty will now stop"); try { for (Handler ha : server.getHandlers()) { ha.stop(); ha.destroy(); h.removeHandler(ha); } this.server.stop(); this.server.join(); this.server.destroy(); this.server = null; jqmlogger.info("Jetty has stopped"); } catch (Exception e) { jqmlogger.error( "An error occured during Jetty stop. It is not an issue if it happens during JQM node shutdown, but one during restart (memeory leak).", e); } }
void stop() { if (server == null) { return; } jqmlogger.trace("Jetty will now stop"); try { for (Handler ha : server.getHandlers()) { ha.stop(); ha.destroy(); handlers.removeHandler(ha); } this.server.stop(); this.server.join(); this.server.destroy(); this.server = null; jqmlogger.info("Jetty has stopped"); } catch (Exception e) { jqmlogger.error( "An error occured during Jetty stop. It is not an issue if it happens during JQM node shutdown, but one during restart (memeory leak).", e); } }
sch.getSessionHandler().setServer(null); sch.getErrorHandler().setServer(null); rootCollections.removeHandler(sch); sch.destroy();
private void recursiveRemoveContext(HandlerCollection coll, ContextHandler context) { Handler children[] = coll.getHandlers(); int originalCount = children.length; for (int i = 0, n = children.length; i < n; i++) { Handler child = children[i]; LOG.debug("Child handler {}",child); if (child.equals(context)) { LOG.debug("Removing handler {}",child); coll.removeHandler(child); child.destroy(); if (LOG.isDebugEnabled()) LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount); } else if (child instanceof HandlerCollection) { recursiveRemoveContext((HandlerCollection)child,context); } } } }
private void recursiveRemoveContext(HandlerCollection coll, ContextHandler context) { Handler children[] = coll.getHandlers(); int originalCount = children.length; for (int i = 0, n = children.length; i < n; i++) { Handler child = children[i]; LOG.debug("Child handler {}",child); if (child.equals(context)) { LOG.debug("Removing handler {}",child); coll.removeHandler(child); child.destroy(); if (LOG.isDebugEnabled()) LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount); } else if (child instanceof HandlerCollection) { recursiveRemoveContext((HandlerCollection)child,context); } } } }
private void recursiveRemoveContext(HandlerCollection coll, ContextHandler context) { Handler children[] = coll.getHandlers(); int originalCount = children.length; for (int i = 0, n = children.length; i < n; i++) { Handler child = children[i]; LOG.debug("Child handler {}",child); if (child.equals(context)) { LOG.debug("Removing handler {}",child); coll.removeHandler(child); child.destroy(); if (LOG.isDebugEnabled()) LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount); } else if (child instanceof HandlerCollection) { recursiveRemoveContext((HandlerCollection)child,context); } } } }
private void recursiveRemoveContext(HandlerCollection coll, ContextHandler context) { Handler children[] = coll.getHandlers(); int originalCount = children.length; for (int i = 0, n = children.length; i < n; i++) { Handler child = children[i]; LOG.debug("Child handler {}",child); if (child.equals(context)) { LOG.debug("Removing handler {}",child); coll.removeHandler(child); child.destroy(); if (LOG.isDebugEnabled()) LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount); } else if (child instanceof HandlerCollection) { recursiveRemoveContext((HandlerCollection)child,context); } } } }