Package org.eclipse.jetty.util.thread

Examples of org.eclipse.jetty.util.thread.QueuedThreadPool


            httpClient.setProxy(new Address(host, port));
        }

        // use QueueThreadPool as the default bounded is deprecated (see SMXCOMP-157)
        if (getHttpClientThreadPool() == null) {
            QueuedThreadPool qtp = new QueuedThreadPool();
            if (httpClientMinThreads != null) {
                qtp.setMinThreads(httpClientMinThreads.intValue());
            }
            if (httpClientMaxThreads != null) {
                qtp.setMaxThreads(httpClientMaxThreads.intValue());
            }
            // let the thread names indicate they are from the client
            qtp.setName("CamelJettyClient(" + ObjectHelper.getIdentityHashCode(httpClient) + ")");
            try {
                qtp.start();
            } catch (Exception e) {
                throw new RuntimeCamelException("Error starting JettyHttpClient thread pool: " + qtp, e);
            }
            setHttpClientThreadPool(qtp);
        }
View Full Code Here


        // configure thread pool if min/max given
        if (minThreads != null || maxThreads != null) {
            if (getThreadPool() != null) {
                throw new IllegalArgumentException("You cannot configure both minThreads/maxThreads and a custom threadPool on JettyHttpComponent: " + this);
            }
            QueuedThreadPool qtp = new QueuedThreadPool();
            if (minThreads != null) {
                qtp.setMinThreads(minThreads.intValue());
            }
            if (maxThreads != null) {
                qtp.setMaxThreads(maxThreads.intValue());
            }
            // let the thread names indicate they are from the server
            qtp.setName("CamelJettyServer(" + ObjectHelper.getIdentityHashCode(server) + ")");
            try {
                qtp.start();
            } catch (Exception e) {
                throw new RuntimeCamelException("Error starting JettyServer thread pool: " + qtp, e);
            }
            server.setThreadPool(qtp);
        }
View Full Code Here

    }
    return site.resolve(path);
  }

  private ThreadPool threadPool(Config cfg) {
    final QueuedThreadPool pool = new QueuedThreadPool();
    pool.setName("HTTP");
    pool.setMinThreads(cfg.getInt("httpd", null, "minthreads", 5));
    pool.setMaxThreads(cfg.getInt("httpd", null, "maxthreads", 25));
    pool.setMaxQueued(cfg.getInt("httpd", null, "maxqueued", 50));
    return pool;
  }
View Full Code Here

      } catch (UnknownHostException e) {
        LOG.error("Error finding host to connect to.", e);
        throw Throwables.propagate(e);
      }

      QueuedThreadPool threadPool = new QueuedThreadPool();
      threadPool.setMaxThreads(maxThreads);
      server.setThreadPool(threadPool);

      initHandlers();

      ServletContextHandler context = new ServletContextHandler();
View Full Code Here

      }
      sslcontext.setNeedClientAuth(Boolean.getBoolean("tests.jettySsl.clientAuth"));
    }
   
    final Connector connector;
    final QueuedThreadPool threadPool;
    if ("SelectChannel".equals(connectorName)) {
      final SelectChannelConnector c = useSsl ? new SslSelectChannelConnector(sslcontext) : new SelectChannelConnector();
      c.setReuseAddress(true);
      c.setLowResourcesMaxIdleTime(1500);
      connector = c;
      threadPool = (QueuedThreadPool) c.getThreadPool();
    } else if ("Socket".equals(connectorName)) {
      final SocketConnector c = useSsl ? new SslSocketConnector(sslcontext) : new SocketConnector();
      c.setReuseAddress(true);
      connector = c;
      threadPool = (QueuedThreadPool) c.getThreadPool();
    } else {
      throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName);
    }
   
    connector.setPort(0);
    connector.setHost("127.0.0.1");
    if (threadPool != null) {
      threadPool.setDaemon(true);
      threadPool.setMaxThreads(10000);
      threadPool.setMaxIdleTimeMs(5000);
      threadPool.setMaxStopTimeMs(30000);
    }
   
    server.setConnectors(new Connector[] {connector});
    server.setSessionIdManager(new HashSessionIdManager(new Random(random().nextLong())));
   
View Full Code Here

  RSSServlet servlet;
   
  public MockRSSService(int docsPerFeed)
  {
    server = new Server(8189);
    server.setThreadPool(new QueuedThreadPool(35));
    servlet = new RSSServlet(docsPerFeed);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/rss");
    server.setHandler(context);
    context.addServlet(new ServletHolder(servlet), "/gen.php");
View Full Code Here

  SessionWebServlet servlet;
   
  public MockSessionWebService(int numContentDocs, String userName, String password)
  {
    server = new Server(8191);
    server.setThreadPool(new QueuedThreadPool(100));
    servlet = new SessionWebServlet(numContentDocs,userName,password);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName","none");
    context.setContextPath("/web");
    server.setHandler(context);
View Full Code Here

  SolrServlet servlet;
   
  public MockSolrService()
  {
    server = new Server(8188);
    server.setThreadPool(new QueuedThreadPool(35));
    servlet = new SolrServlet();
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName","none");
    context.setContextPath("/solr");
    server.setHandler(context);
View Full Code Here

  WikiAPIServlet servlet;
   
  public MockWikiService(Class theResourceClass)
  {
    server = new Server(8089);
    server.setThreadPool(new QueuedThreadPool(35));
    servlet = new WikiAPIServlet(theResourceClass);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/w");
    server.setHandler(context);
    context.addServlet(new ServletHolder(servlet), "/api.php");
View Full Code Here

  WebServlet servlet;
   
  public MockWebService(int docsPerLevel)
  {
    server = new Server(8191);
    server.setThreadPool(new QueuedThreadPool(100));
    servlet = new WebServlet(docsPerLevel);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/web");
    server.setHandler(context);
    context.addServlet(new ServletHolder(servlet), "/gen.php");
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.thread.QueuedThreadPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.