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

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

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

ThreadPool.isLowOnThreads介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

public boolean isLowResources()
{
  if (_threadPool != null)
    return _threadPool.isLowOnThreads();
  return _server.getThreadPool().isLowOnThreads();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

public boolean isLowResources()
{
  if (_threadPool != null)
    return _threadPool.isLowOnThreads();
  return _server.getThreadPool().isLowOnThreads();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

public boolean isLowResources()
{
  if (_threadPool != null)
    return _threadPool.isLowOnThreads();
  return _server.getThreadPool().isLowOnThreads();
}

代码示例来源:origin: org.eclipse.jetty/server

public boolean isLowResources()
{
  if (_threadPool != null)
    return _threadPool.isLowOnThreads();
  return _server.getThreadPool().isLowOnThreads();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public boolean isLowResources()
{
  if (_threadPool != null)
    return _threadPool.isLowOnThreads();
  return _server.getThreadPool().isLowOnThreads();
}

代码示例来源:origin: com.teradata.airlift/http-server

private static void checkSufficientThreads(Connector connector, String name)
{
  if (connector == null) {
    return;
  }
  Executor executor = connector.getExecutor();
  if (executor instanceof ThreadPool) {
    ThreadPool queuedThreadPool = (ThreadPool) executor;
    checkState(!queuedThreadPool.isLowOnThreads(), "insufficient threads configured for %s connector", name);
  }
}

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

@Override
public boolean isJettyCQSRequestHandlerPoolLowOnThreads() {
  return CMB.cqsServer.getThreadPool().isLowOnThreads();
}

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

@Override
public boolean isJettyCNSRequestHandlerPoolLowOnThreads() {
  return CMB.cnsServer.getThreadPool().isLowOnThreads();
}

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

@Override
public boolean isLowOnResources()
{
  ThreadPool serverThreads = _server.getThreadPool();
  if (serverThreads.isLowOnThreads())
  {
    reason="Server low on threads: "+serverThreads;
    return true;
  }
  return false;
}

代码示例来源:origin: com.teradata.airlift/http-server

@PostConstruct
public void start()
    throws Exception
{
  server.start();
  checkState(server.isStarted(), "server is not started");
  // The combination of an NIO connector and an insufficient number of threads results
  // in a server that hangs after accepting connections. Jetty scales the number of
  // required threads based on the number of available processors in a non-trivial way,
  // so a config that works on one machine might fail on a larger machine without an
  // obvious reason why. Thus, we need this runtime check after startup as a safeguard.
  checkSufficientThreads(httpConnector, "HTTP");
  checkSufficientThreads(httpsConnector, "HTTPS");
  checkSufficientThreads(adminConnector, "admin");
  checkState(!server.getThreadPool().isLowOnThreads(), "insufficient threads configured for server connector");
}

代码示例来源:origin: benmfaul/XRTB

/**
 * Retrieve a summary of activity.
 * 
 * @return String. JSON based stats of server performance.
 */
public static String getSummary() throws Exception {
  setSummaryStats();
  Map m = new HashMap();
  m.put("stopped", stopped);
  m.put("loglevel", Configuration.getInstance().logLevel);
  m.put("ncampaigns", campaigns.size());
  m.put("qps", qps);
  m.put("deltax", avgx);
  m.put("nobidreason", Configuration.getInstance().printNoBidReason);
  m.put("cpu", Performance.getCpuPerfAsString());
  m.put("memUsed", Performance.getMemoryUsed());
  m.put("cores", Performance.getCores());
  m.put("diskFree", Performance.getPercFreeDisk());
  m.put("openfiles", Performance.getOpenFileDescriptorCount());
  m.put("exchanges", BidRequest.getExchangeCounts());
  m.put("lowonthreads", server.getThreadPool().isLowOnThreads());
  m.put("instance", Configuration.instanceName);
  return DbTools.mapper.writeValueAsString(m);
}

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

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

if (_monitorThreads && threadpool.isLowOnThreads())

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

if (_monitorThreads && threadpool.isLowOnThreads())

代码示例来源:origin: Nextdoor/bender

if (_monitorThreads && threadpool.isLowOnThreads())

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

@Override
protected void doStart() throws Exception
{
  if (_server == null)
    throw new IllegalStateException("No server");
  // open listener port
  open();
  if (_threadPool == null)
  {
    _threadPool = _server.getThreadPool();
    addBean(_threadPool,false);
  }
  super.doStart();
  // Start selector thread
  synchronized (this)
  {
    _acceptorThreads = new Thread[getAcceptors()];
    for (int i = 0; i < _acceptorThreads.length; i++)
      if (!_threadPool.dispatch(new Acceptor(i)))
        throw new IllegalStateException("!accepting");
    if (_threadPool.isLowOnThreads())
      LOG.warn("insufficient threads configured for {}",this);
  }
  LOG.info("Started {}",this);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

@Override
protected void doStart() throws Exception
{
  if (_server == null)
    throw new IllegalStateException("No server");
  // open listener port
  open();
  if (_threadPool == null)
  {
    _threadPool = _server.getThreadPool();
    addBean(_threadPool,false);
  }
  super.doStart();
  // Start selector thread
  synchronized (this)
  {
    _acceptorThreads = new Thread[getAcceptors()];
    for (int i = 0; i < _acceptorThreads.length; i++)
      if (!_threadPool.dispatch(new Acceptor(i)))
        throw new IllegalStateException("!accepting");
    if (_threadPool.isLowOnThreads())
      LOG.warn("insufficient threads configured for {}",this);
  }
  LOG.info("Started {}",this);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

@Override
protected void doStart() throws Exception
{
  if (_server == null)
    throw new IllegalStateException("No server");
  // open listener port
  open();
  if (_threadPool == null)
  {
    _threadPool = _server.getThreadPool();
    addBean(_threadPool,false);
  }
  super.doStart();
  // Start selector thread
  synchronized (this)
  {
    _acceptorThreads = new Thread[getAcceptors()];
    for (int i = 0; i < _acceptorThreads.length; i++)
      if (!_threadPool.dispatch(new Acceptor(i)))
        throw new IllegalStateException("!accepting");
    if (_threadPool.isLowOnThreads())
      LOG.warn("insufficient threads configured for {}",this);
  }
  LOG.info("Started {}",this);
}

代码示例来源:origin: org.eclipse.jetty/server

@Override
protected void doStart() throws Exception
{
  if (_server == null)
    throw new IllegalStateException("No server");
  // open listener port
  open();
  if (_threadPool == null)
  {
    _threadPool = _server.getThreadPool();
    addBean(_threadPool,false);
  }
  super.doStart();
  // Start selector thread
  synchronized (this)
  {
    _acceptorThreads = new Thread[getAcceptors()];
    for (int i = 0; i < _acceptorThreads.length; i++)
      if (!_threadPool.dispatch(new Acceptor(i)))
        throw new IllegalStateException("!accepting");
    if (_threadPool.isLowOnThreads())
      LOG.warn("insufficient threads configured for {}",this);
  }
  LOG.info("Started {}",this);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

@Override
protected void doStart() throws Exception
{
  if (_server == null)
    throw new IllegalStateException("No server");
  // open listener port
  open();
  if (_threadPool == null)
  {
    _threadPool = _server.getThreadPool();
    addBean(_threadPool,false);
  }
  super.doStart();
  // Start selector thread
  synchronized (this)
  {
    _acceptorThreads = new Thread[getAcceptors()];
    for (int i = 0; i < _acceptorThreads.length; i++)
      if (!_threadPool.dispatch(new Acceptor(i)))
        throw new IllegalStateException("!accepting");
    if (_threadPool.isLowOnThreads())
      LOG.warn("insufficient threads configured for {}",this);
  }
  LOG.info("Started {}",this);
}

相关文章