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

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

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

Container.findLifecycleListeners介绍

暂无

代码示例

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

/**
 * List the class name of each of the lifecycle listeners added to this
 * container.
 * @return the lifecycle listeners class names
 * @throws MBeanException propagated from the managed resource access
 */
public String[] findLifecycleListenerNames() throws MBeanException {
  Container container = doGetManagedResource();
  List<String> result = new ArrayList<>();
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for(LifecycleListener listener: listeners){
    result.add(listener.getClass().getName());
  }
  return result.toArray(new String[result.size()]);
}

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

/**
 * List the class name of each of the lifecycle listeners added to this
 * container.
 * @return the lifecycle listeners class names
 * @throws MBeanException propagated from the managed resource access
 */
public String[] findLifecycleListenerNames() throws MBeanException {
  Container container = doGetManagedResource();
  List<String> result = new ArrayList<>();
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for(LifecycleListener listener: listeners){
    result.add(listener.getClass().getName());
  }
  return result.toArray(new String[result.size()]);
}

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

/**
 * Remove a LifecycleEvent listeners from this component.
 *
 * @param type The ClassName of the listeners to be removed.
 * Note that all the listeners having given ClassName will be removed.
 * @throws MBeanException propagated from the managed resource access
 */
public void removeLifecycleListeners(String type) throws MBeanException{
  Container container = doGetManagedResource();
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for (LifecycleListener listener : listeners){
    if (listener.getClass().getName().equals(type)) {
      container.removeLifecycleListener(listener);
    }
  }
}

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

/**
 * Remove a LifecycleEvent listeners from this component.
 *
 * @param type The ClassName of the listeners to be removed.
 * Note that all the listeners having given ClassName will be removed.
 * @throws MBeanException propagated from the managed resource access
 */
public void removeLifecycleListeners(String type) throws MBeanException{
  Container container = doGetManagedResource();
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for (LifecycleListener listener : listeners){
    if (listener.getClass().getName().equals(type)) {
      container.removeLifecycleListener(listener);
    }
  }
}

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

/**
 * List the class name of each of the lifecycle listeners added to this
 * container.
 */
public String[] findLifecycleListenerNames() throws MBeanException {
  Container container = null;
  List<String> result = new ArrayList<>();
  try {
    container = (Container) getManagedResource();
  } catch (InstanceNotFoundException e) {
    throw new MBeanException(e);
  } catch (RuntimeOperationsException e) {
    throw new MBeanException(e);
  } catch (InvalidTargetObjectTypeException e) {
    throw new MBeanException(e);
  }
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for(LifecycleListener listener: listeners){
    result.add(listener.getClass().getName());
  }
  return result.toArray(new String[result.size()]);
}

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

/**
 * Remove a LifecycleEvent listeners from this component.
 *
 * @param type The ClassName of the listeners to be removed.
 * Note that all the listeners having given ClassName will be removed.
 */
public void removeLifecycleListeners(String type) throws MBeanException{
  Container container=null;
  try {
    container = (Container)getManagedResource();
  } catch (InstanceNotFoundException e) {
    throw new MBeanException(e);
  } catch (RuntimeOperationsException e) {
    throw new MBeanException(e);
  } catch (InvalidTargetObjectTypeException e) {
    throw new MBeanException(e);
  }
  LifecycleListener[] listeners = container.findLifecycleListeners();
  for(LifecycleListener listener: listeners){
    if(listener.getClass().getName().equals(type)){
      container.removeLifecycleListener(listener);
    }
  }
}

相关文章

微信公众号

最新文章

更多