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

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

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

ThreadPool.getThreads介绍

暂无

代码示例

代码示例来源: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: apache/hbase

@Override
 public void run() {
  ready.countDown();
  try {
   start.await();
   assertEquals("a:b\nc:d\n",
          readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
   int serverThreads = server.webServer.getThreadPool().getThreads();
   assertTrue("More threads are started than expected, Server Threads count: "
       + serverThreads, serverThreads <= MAX_THREADS);
   System.out.println("Number of threads = " + serverThreads +
     " which is less or equal than the max = " + MAX_THREADS);
  } catch (Exception e) {
   // do nothing
  }
 }
});

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

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

代码示例来源:origin: Comcast/cmb

@Override
public int getJettyCNSRequestHandlerPoolSize() {
  return CMB.cnsServer.getThreadPool().getThreads();
}

代码示例来源:origin: Comcast/cmb

@Override
public int getJettyCQSRequestHandlerPoolSize() {
  return CMB.cqsServer.getThreadPool().getThreads();
}

代码示例来源: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;
}

相关文章