org.apache.catalina.Container.removeChild()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.catalina.Container.removeChild()方法的一些代码示例,展示了Container.removeChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.removeChild()方法的具体详情如下:
包路径:org.apache.catalina.Container
类名称:Container
方法名:removeChild

Container.removeChild介绍

[英]Remove an existing child Container from association with this parent Container.
[中]从与此父容器的关联中删除现有子容器。

代码示例

代码示例来源:origin: org.springframework.osgi/spring-osgi-web

private void removeContext(Context context) {
  context.getParent().removeChild(context);
}

代码示例来源:origin: org.springframework.osgi/org.springframework.osgi.web

private void removeContext(Context context) {
  context.getParent().removeChild(context);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

public void removeWebService(String contextPath) {
  TomcatEJBWebServiceContext context = (TomcatEJBWebServiceContext) webServices.get(contextPath);
  try {
    context.stop();
    context.destroy();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  context.getParent().removeChild(context);
  webServices.remove(contextPath);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public void removeWebService(String contextPath) {
  TomcatEJBWebServiceContext context = (TomcatEJBWebServiceContext) webServices.get(contextPath);
  try {
    context.stop();
    context.destroy();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  context.getParent().removeChild(context);
  webServices.remove(contextPath);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Remove an existing child Container from association with this parent
 * Container.
 *
 * @param name Name of the existing child Container to be removed
 * @throws MBeanException if the child cannot be removed
 */
public void removeChild(String name) throws MBeanException{
  if (name != null) {
    Container container = doGetManagedResource();
    Container contained = container.findChild(name);
    container.removeChild(contained);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Remove an existing child Container from association with this parent
 * Container.
 *
 * @param name Name of the existing child Container to be removed
 * @throws MBeanException if the child cannot be removed
 */
public void removeChild(String name) throws MBeanException{
  if (name != null) {
    Container container = doGetManagedResource();
    Container contained = container.findChild(name);
    container.removeChild(contained);
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public void removeContext(TomcatContext ctx) {
  Context context = ctx.getContext();
  if (context != null) {
    if (context instanceof GeronimoStandardContext) {
      GeronimoStandardContext stdctx = (GeronimoStandardContext) context;
      
      try {
        stdctx.kill();
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    if (context.getParent() != null) {
      context.getParent().removeChild(context);
    }
  }
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

private static boolean undeploy(final StandardContext standardContext, final Container host) {
  final Container child = host.findChild(standardContext.getName());
  // skip undeployment if redeploying (StandardContext.redeploy())
  if (child instanceof org.apache.catalina.Context && org.apache.catalina.Context.class.cast(child).getPaused()) {
    return true;
  }
  // skip undeployment if restarting
  final TomEEWebappClassLoader tomEEWebappClassLoader = lazyClassLoader(
    org.apache.catalina.Context.class.isInstance(child) ? org.apache.catalina.Context.class.cast(child) : null);
  if (tomEEWebappClassLoader != null && tomEEWebappClassLoader.isRestarting()) {
    return true;
  }
  if (child != null) {
    host.removeChild(standardContext);
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

public void removeContext(TomcatContext ctx) {
  Context context = ctx.getContext();
  if (context != null) {
    if (context instanceof GeronimoStandardContext) {
      GeronimoStandardContext stdctx = (GeronimoStandardContext) context;
      try {
        stdctx.stop();
        stdctx.destroy();
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    context.getParent().removeChild(context);
  }
}

代码示例来源:origin: org.switchyard/switchyard-deploy-jboss-as7

/**
   * {@inheritDoc}
   */
  public void stop() {
    if (_context != null) {
      // Destroy the web context unless if it is default
      if (!_context.getPath().equals("/")) {
        try {
          Container container = _context.getParent();
          container.removeChild(_context);
          _context.stop();
          _context.destroy();
          LOG.info("Destroyed HTTP context " + _context.getPath());
        } catch (Exception e) {
          LOG.error("Unable to destroy web context", e);
        }
      }
    }
  }
}

代码示例来源:origin: org.switchyard/switchyard-deploy-jboss-as7

@Override
public synchronized void stop() throws Exception {
  if (_serverContext != null) {
    // Destroy the web context unless if it is default
    if (!_serverContext.getPath().equals("/")) {
      try {
        Container container = _serverContext.getParent();
        container.removeChild(_serverContext);
        _serverContext.stop();
        _serverContext.destroy();
        _log.info("Destroyed HTTP context " + _serverContext.getPath());
      } catch (Exception e) {
        ExtensionLogger.ROOT_LOGGER.unableToDestroyWebContext(_contextName, e);
      }
    }
  }
}

代码示例来源:origin: jboss-switchyard/release

@Override
public synchronized void stop() throws Exception {
  if (_serverContext != null) {
    // Destroy the web context unless if it is default
    if (!_serverContext.getPath().equals("/")) {
      try {
        Container container = _serverContext.getParent();
        container.removeChild(_serverContext);
        _serverContext.stop();
        _serverContext.destroy();
        _log.info("Destroyed HTTP context " + _serverContext.getPath());
      } catch (Exception e) {
        ExtensionLogger.ROOT_LOGGER.unableToDestroyWebContext(_contextName, e);
      }
    }
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
protected void destroyInternal() throws LifecycleException {
  // Stop the Valves in our pipeline (including the basic), if any
  if (pipeline instanceof Lifecycle) {
    ((Lifecycle) pipeline).destroy();
  }
  // Remove children now this container is being destroyed
  for (Container child : findChildren()) {
    removeChild(child);
  }
  // Required if the child is destroyed directly.
  if (parent != null) {
    parent.removeChild(this);
  }
  super.destroyInternal();
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
protected void destroyInternal() throws LifecycleException {
  // Stop the Valves in our pipeline (including the basic), if any
  if (pipeline instanceof Lifecycle) {
    ((Lifecycle) pipeline).destroy();
  }
  // Remove children now this container is being destroyed
  for (Container child : findChildren()) {
    removeChild(child);
  }
  // Required if the child is destroyed directly.
  if (parent != null) {
    parent.removeChild(this);
  }
  super.destroyInternal();
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
protected void destroyInternal() throws LifecycleException {
  // Stop the Valves in our pipeline (including the basic), if any
  if (pipeline instanceof Lifecycle) {
    ((Lifecycle) pipeline).destroy();
  }
  // Remove children now this container is being destroyed
  for (Container child : findChildren()) {
    removeChild(child);
  }
  // Required if the child is destroyed directly.
  if (parent != null) {
    parent.removeChild(this);
  }
  super.destroyInternal();
}

代码示例来源:origin: org.jboss.as/jboss-as-webservices-server-integration

private static void stopWebApp(StandardContext context) throws Exception {
  try {
    Container container = context.getParent();
    container.removeChild(context);
    context.stop();
  } catch (LifecycleException e) {
    throw MESSAGES.stopContextPhaseFailed(e);
  }
  try {
    context.destroy();
  } catch (Exception e) {
    throw MESSAGES.destroyContextPhaseFailed(e);
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-webservices-server-integration

private void stopWebApp(StandardContext context) throws Exception {
  try {
    Container container = context.getParent();
    container.removeChild(context);
    context.stop();
  } catch (LifecycleException e) {
    throw MESSAGES.stopContextPhaseFailed(e);
  }
  try {
    context.destroy();
  } catch (Exception e) {
    throw MESSAGES.destroyContextPhaseFailed(e);
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Remove an existing child Container from association with this parent
 * Container.
 *
 * @param name Name of the existing child Container to be removed
 */
public void removeChild(String name) throws MBeanException{
  if(name != null){
    try {
      Container container = (Container)getManagedResource();
      Container contained = container.findChild(name);
      container.removeChild(contained);
    } catch (InstanceNotFoundException e) {
      throw new MBeanException(e);
    } catch (RuntimeOperationsException e) {
      throw new MBeanException(e);
    } catch (InvalidTargetObjectTypeException e) {
      throw new MBeanException(e);
    }
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Remove an existing child Container from association with this parent
 * Container.
 *
 * @param name Name of the existing child Container to be removed
 */
public void removeChild(String name) throws MBeanException{
  if(name != null){
    try {
      Container container = (Container)getManagedResource();
      Container contained = container.findChild(name);
      container.removeChild(contained);
    } catch (InstanceNotFoundException e) {
      throw new MBeanException(e);
    } catch (RuntimeOperationsException e) {
      throw new MBeanException(e);
    } catch (InvalidTargetObjectTypeException e) {
      throw new MBeanException(e);
    }
  }
}

代码示例来源:origin: org.mobicents.arquillian.container/mss-tomcat-embedded-6

@Override
public synchronized void removeContext(Context context) {
  if( log.isDebugEnabled() )
    log.debug("Removing context[" + context.getPath() + "]");
  boolean isContextExists = isContextExists(context);
  if(!isContextExists)
    return;
  
  // Remove this Context from the associated Host
  if( log.isDebugEnabled() )
    log.debug(" Removing this Context");
  context.getParent().removeChild(context);
}

相关文章

微信公众号

最新文章

更多