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

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

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

Container.findContainerListeners介绍

[英]Return the set of container listeners associated with this Container. If this Container has no registered container listeners, a zero-length array is returned.
[中]返回与此容器关联的容器侦听器集。如果此容器没有注册的容器侦听器,则返回零长度数组。

代码示例

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

/**
   * List the class name of each of the container listeners added to this
   * container.
   * @return the container listeners class names
   * @throws MBeanException propagated from the managed resource access
   */
  public String[] findContainerListenerNames() throws MBeanException {
    Container container = doGetManagedResource();
    List<String> result = new ArrayList<>();

    ContainerListener[] listeners = container.findContainerListeners();
    for(ContainerListener 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 container listeners added to this
   * container.
   * @return the container listeners class names
   * @throws MBeanException propagated from the managed resource access
   */
  public String[] findContainerListenerNames() throws MBeanException {
    Container container = doGetManagedResource();
    List<String> result = new ArrayList<>();

    ContainerListener[] listeners = container.findContainerListeners();
    for(ContainerListener listener: listeners){
      result.add(listener.getClass().getName());
    }

    return result.toArray(new String[result.size()]);
  }
}

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

/**
   * List the class name of each of the container listeners added to this
   * container.
   */
  public String[] findContainerListenerNames() 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);
    }

    ContainerListener[] listeners = container.findContainerListeners();
    for(ContainerListener listener: listeners){
      result.add(listener.getClass().getName());
    }

    return result.toArray(new String[result.size()]);
  }
}

相关文章

微信公众号

最新文章

更多