protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
/** * Remove this mapper from the container and all child containers * * @param container */ private void removeListeners(Container container) { container.removeContainerListener(this); container.removeLifecycleListener(this); for (Container child : container.findChildren()) { removeListeners(child); } } }
private void removeListeners(Server server) { // Unregister ourself as a listener to child components for (Service service: server.findServices()) { Container engine = service.getContainer(); engine.removeContainerListener(this); ((Lifecycle) engine).removeLifecycleListener(this); for (Container host: engine.findChildren()) { host.removeContainerListener(this); for (Container context: host.findChildren()) { ((Lifecycle) context).removeLifecycleListener(this); } } } }
protected void removeListeners(Server server) { // Unregister ourself as a listener to child components for (Service service : server.findServices()) { Container engine = service.getContainer(); engine.removeContainerListener(this); engine.removeLifecycleListener(this); for (Container host : engine.findChildren()) { host.removeContainerListener(this); for (Container context : host.findChildren()) { context.removeLifecycleListener(this); context.removePropertyChangeListener(this); } } } }
@Override protected void removeListeners(Server server) { // Unregister ourself as a listener to child components for (Service service : server.findServices()) { Container engine = service.getContainer(); engine.removeContainerListener(this); engine.removeLifecycleListener(this); for (Container host : engine.findChildren()) { host.removeContainerListener(this); for (Container context : host.findChildren()) { context.removeLifecycleListener(this); context.removePropertyChangeListener(this); } } } } }
@Test public void destroyServer() throws Exception { TomcatEventHandler handler = this.createEventHandler(this.eventHandler, this.provider, this.factory); LifecycleServer server = mock(LifecycleServer.class); LifecycleEvent event = createBeforeDestroyInitEvent(server); handler.lifecycleEvent(event); Mockito.verifyZeroInteractions(this.eventHandler); this.initServer(handler, server); Service service = mock(Service.class); LifecycleEngine engine = mock(LifecycleEngine.class); Container container = mock(Container.class); LifecycleContainer childContainer = mock(LifecycleContainer.class); when(server.findServices()).thenReturn(new Service[] { service }); when(service.getContainer()).thenReturn(engine); when(engine.findChildren()).thenReturn(new Container[] { container }); when(container.findChildren()).thenReturn(new Container[] { childContainer }); handler.lifecycleEvent(event); verify(engine).removeContainerListener(handler); verify(engine).removeLifecycleListener(handler); verify(container).removeContainerListener(handler); verify(childContainer).removeLifecycleListener(handler); verify(this.eventHandler).shutdown(); reset(this.eventHandler); handler.lifecycleEvent(event); Mockito.verifyZeroInteractions(this.eventHandler); }