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

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

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

Container.getService介绍

[英]Return the Service to which this container belongs.
[中]返回此容器所属的服务。

代码示例

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

@Override
protected void initInternal() throws LifecycleException {
  super.initInternal();
  if (clusterDeployer != null) {
    StringBuilder name = new StringBuilder("type=Cluster");
    Container container = getContainer();
    if (container != null) {
      name.append(container.getMBeanKeyProperties());
    }
    name.append(",component=Deployer");
    onameClusterDeployer = register(clusterDeployer, name.toString());
  }
  channel.setUtilityExecutor(Container.getService(getContainer()).getServer().getUtilityExecutor());
}

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

private void reconfigureStartStopExecutor(int threads) {
  if (threads == 1) {
    // Use a fake executor
    if (!(startStopExecutor instanceof InlineExecutorService)) {
      startStopExecutor = new InlineExecutorService();
    }
  } else {
    // Delegate utility execution to the Service
    Server server = Container.getService(this).getServer();
    server.setUtilityThreads(threads);
    startStopExecutor = server.getUtilityExecutor();
  }
}

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

/**
 * Start the background thread that will periodically check for
 * session timeouts.
 */
protected void threadStart() {
  if (backgroundProcessorDelay > 0
      && (getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState()))
      && (backgroundProcessorFuture == null || backgroundProcessorFuture.isDone())) {
    if (backgroundProcessorFuture != null && backgroundProcessorFuture.isDone()) {
      // There was an error executing the scheduled task, get it and log it
      try {
        backgroundProcessorFuture.get();
      } catch (InterruptedException | ExecutionException e) {
        log.error(sm.getString("containerBase.backgroundProcess.error"), e);
      }
    }
    backgroundProcessorFuture = Container.getService(this).getServer().getUtilityExecutor()
        .scheduleWithFixedDelay(new ContainerBackgroundProcessor(),
            backgroundProcessorDelay, backgroundProcessorDelay,
            TimeUnit.SECONDS);
  }
}

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

monitorFuture = Container.getService(ContainerBase.this).getServer()
    .getUtilityExecutor().scheduleWithFixedDelay(
        new ContainerBackgroundProcessorMonitor(), 0, 60, TimeUnit.SECONDS);

相关文章

微信公众号

最新文章

更多