org.eclipse.jetty.util.thread.ThreadPool.getIdleThreads()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(120)

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

ThreadPool.getIdleThreads介绍

暂无

代码示例

代码示例来源:origin: perwendel/spark

@Override
public int activeThreadCount() {
  if (server == null) {
    return 0;
  }
  return server.getThreadPool().getThreads() - server.getThreadPool().getIdleThreads();
}

代码示例来源:origin: loklak/loklak_server

public static int getServerThreads() {
  return server.getThreadPool().getThreads() - server.getThreadPool().getIdleThreads();
}

代码示例来源:origin: yacy/yacy_grid_mcp

public static int getServerThreads() {
  return server.getThreadPool().getThreads() - server.getThreadPool().getIdleThreads();
}

代码示例来源:origin: org.nanoframework/nano-jetty-server

protected void startServer() {
  try {
    writePid2File();
    super.start();
    LOGGER.info("Current thread: {} | Idle thread: {}", super.getThreadPool().getThreads(), super.getThreadPool().getIdleThreads());
    super.join();
  } catch (final Throwable e) {
    // NANO-386: fixed Address already in use bug
    LOGGER.error("Bootstrap server error: {}", e.getMessage());
    System.exit(1);
  }
}

代码示例来源:origin: com.sparkjava/spark-core

@Override
public int activeThreadCount() {
  if (server == null) {
    return 0;
  }
  return server.getThreadPool().getThreads() - server.getThreadPool().getIdleThreads();
}

代码示例来源:origin: jenkinsci/winstone

@Override
public boolean isLowOnResources()
{
  ThreadPool serverThreads = _server.getThreadPool();
  if(serverThreads.isLowOnThreads())
  {
    reason ="Server low on threads: "+serverThreads.getThreads()+", idleThreads:"+serverThreads.getIdleThreads();
    return true;
  }
  for(Connector connector : getMonitoredConnectors())
  {
    Executor executor = connector.getExecutor();
    if (executor instanceof ThreadPool && executor!=serverThreads)
    {
      ThreadPool connectorThreads=(ThreadPool)executor;
      if (connectorThreads.isLowOnThreads())
      {
        reason ="Connector low on threads: "+connectorThreads;
        return true;
      }
    }
  }
  return false;
}

相关文章