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

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

本文整理了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

  1. public boolean isLowResources()
  2. {
  3. if (_threadPool != null)
  4. return _threadPool.isLowOnThreads();
  5. return _server.getThreadPool().isLowOnThreads();
  6. }

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

  1. public boolean isLowResources()
  2. {
  3. if (_threadPool != null)
  4. return _threadPool.isLowOnThreads();
  5. return _server.getThreadPool().isLowOnThreads();
  6. }

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

  1. public boolean isLowResources()
  2. {
  3. if (_threadPool != null)
  4. return _threadPool.isLowOnThreads();
  5. return _server.getThreadPool().isLowOnThreads();
  6. }

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

  1. public boolean isLowResources()
  2. {
  3. if (_threadPool != null)
  4. return _threadPool.isLowOnThreads();
  5. return _server.getThreadPool().isLowOnThreads();
  6. }

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

  1. public boolean isLowResources()
  2. {
  3. if (_threadPool != null)
  4. return _threadPool.isLowOnThreads();
  5. return _server.getThreadPool().isLowOnThreads();
  6. }

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

  1. private static void checkSufficientThreads(Connector connector, String name)
  2. {
  3. if (connector == null) {
  4. return;
  5. }
  6. Executor executor = connector.getExecutor();
  7. if (executor instanceof ThreadPool) {
  8. ThreadPool queuedThreadPool = (ThreadPool) executor;
  9. checkState(!queuedThreadPool.isLowOnThreads(), "insufficient threads configured for %s connector", name);
  10. }
  11. }

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

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

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

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

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

  1. @Override
  2. public boolean isLowOnResources()
  3. {
  4. ThreadPool serverThreads = _server.getThreadPool();
  5. if (serverThreads.isLowOnThreads())
  6. {
  7. reason="Server low on threads: "+serverThreads;
  8. return true;
  9. }
  10. return false;
  11. }

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

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

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

  1. /**
  2. * Retrieve a summary of activity.
  3. *
  4. * @return String. JSON based stats of server performance.
  5. */
  6. public static String getSummary() throws Exception {
  7. setSummaryStats();
  8. Map m = new HashMap();
  9. m.put("stopped", stopped);
  10. m.put("loglevel", Configuration.getInstance().logLevel);
  11. m.put("ncampaigns", campaigns.size());
  12. m.put("qps", qps);
  13. m.put("deltax", avgx);
  14. m.put("nobidreason", Configuration.getInstance().printNoBidReason);
  15. m.put("cpu", Performance.getCpuPerfAsString());
  16. m.put("memUsed", Performance.getMemoryUsed());
  17. m.put("cores", Performance.getCores());
  18. m.put("diskFree", Performance.getPercFreeDisk());
  19. m.put("openfiles", Performance.getOpenFileDescriptorCount());
  20. m.put("exchanges", BidRequest.getExchangeCounts());
  21. m.put("lowonthreads", server.getThreadPool().isLowOnThreads());
  22. m.put("instance", Configuration.instanceName);
  23. return DbTools.mapper.writeValueAsString(m);
  24. }

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

  1. @Override
  2. public boolean isLowOnResources()
  3. {
  4. ThreadPool serverThreads = _server.getThreadPool();
  5. if(serverThreads.isLowOnThreads())
  6. {
  7. reason ="Server low on threads: "+serverThreads.getThreads()+", idleThreads:"+serverThreads.getIdleThreads();
  8. return true;
  9. }
  10. for(Connector connector : getMonitoredConnectors())
  11. {
  12. Executor executor = connector.getExecutor();
  13. if (executor instanceof ThreadPool && executor!=serverThreads)
  14. {
  15. ThreadPool connectorThreads=(ThreadPool)executor;
  16. if (connectorThreads.isLowOnThreads())
  17. {
  18. reason ="Connector low on threads: "+connectorThreads;
  19. return true;
  20. }
  21. }
  22. }
  23. return false;
  24. }

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

  1. if (_monitorThreads && threadpool.isLowOnThreads())

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

  1. if (_monitorThreads && threadpool.isLowOnThreads())

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

  1. if (_monitorThreads && threadpool.isLowOnThreads())

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

  1. @Override
  2. protected void doStart() throws Exception
  3. {
  4. if (_server == null)
  5. throw new IllegalStateException("No server");
  6. // open listener port
  7. open();
  8. if (_threadPool == null)
  9. {
  10. _threadPool = _server.getThreadPool();
  11. addBean(_threadPool,false);
  12. }
  13. super.doStart();
  14. // Start selector thread
  15. synchronized (this)
  16. {
  17. _acceptorThreads = new Thread[getAcceptors()];
  18. for (int i = 0; i < _acceptorThreads.length; i++)
  19. if (!_threadPool.dispatch(new Acceptor(i)))
  20. throw new IllegalStateException("!accepting");
  21. if (_threadPool.isLowOnThreads())
  22. LOG.warn("insufficient threads configured for {}",this);
  23. }
  24. LOG.info("Started {}",this);
  25. }

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

  1. @Override
  2. protected void doStart() throws Exception
  3. {
  4. if (_server == null)
  5. throw new IllegalStateException("No server");
  6. // open listener port
  7. open();
  8. if (_threadPool == null)
  9. {
  10. _threadPool = _server.getThreadPool();
  11. addBean(_threadPool,false);
  12. }
  13. super.doStart();
  14. // Start selector thread
  15. synchronized (this)
  16. {
  17. _acceptorThreads = new Thread[getAcceptors()];
  18. for (int i = 0; i < _acceptorThreads.length; i++)
  19. if (!_threadPool.dispatch(new Acceptor(i)))
  20. throw new IllegalStateException("!accepting");
  21. if (_threadPool.isLowOnThreads())
  22. LOG.warn("insufficient threads configured for {}",this);
  23. }
  24. LOG.info("Started {}",this);
  25. }

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

  1. @Override
  2. protected void doStart() throws Exception
  3. {
  4. if (_server == null)
  5. throw new IllegalStateException("No server");
  6. // open listener port
  7. open();
  8. if (_threadPool == null)
  9. {
  10. _threadPool = _server.getThreadPool();
  11. addBean(_threadPool,false);
  12. }
  13. super.doStart();
  14. // Start selector thread
  15. synchronized (this)
  16. {
  17. _acceptorThreads = new Thread[getAcceptors()];
  18. for (int i = 0; i < _acceptorThreads.length; i++)
  19. if (!_threadPool.dispatch(new Acceptor(i)))
  20. throw new IllegalStateException("!accepting");
  21. if (_threadPool.isLowOnThreads())
  22. LOG.warn("insufficient threads configured for {}",this);
  23. }
  24. LOG.info("Started {}",this);
  25. }

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

  1. @Override
  2. protected void doStart() throws Exception
  3. {
  4. if (_server == null)
  5. throw new IllegalStateException("No server");
  6. // open listener port
  7. open();
  8. if (_threadPool == null)
  9. {
  10. _threadPool = _server.getThreadPool();
  11. addBean(_threadPool,false);
  12. }
  13. super.doStart();
  14. // Start selector thread
  15. synchronized (this)
  16. {
  17. _acceptorThreads = new Thread[getAcceptors()];
  18. for (int i = 0; i < _acceptorThreads.length; i++)
  19. if (!_threadPool.dispatch(new Acceptor(i)))
  20. throw new IllegalStateException("!accepting");
  21. if (_threadPool.isLowOnThreads())
  22. LOG.warn("insufficient threads configured for {}",this);
  23. }
  24. LOG.info("Started {}",this);
  25. }

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

  1. @Override
  2. protected void doStart() throws Exception
  3. {
  4. if (_server == null)
  5. throw new IllegalStateException("No server");
  6. // open listener port
  7. open();
  8. if (_threadPool == null)
  9. {
  10. _threadPool = _server.getThreadPool();
  11. addBean(_threadPool,false);
  12. }
  13. super.doStart();
  14. // Start selector thread
  15. synchronized (this)
  16. {
  17. _acceptorThreads = new Thread[getAcceptors()];
  18. for (int i = 0; i < _acceptorThreads.length; i++)
  19. if (!_threadPool.dispatch(new Acceptor(i)))
  20. throw new IllegalStateException("!accepting");
  21. if (_threadPool.isLowOnThreads())
  22. LOG.warn("insufficient threads configured for {}",this);
  23. }
  24. LOG.info("Started {}",this);
  25. }

相关文章