Refine search
Log.getLog().setDebugEnabled(false); QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setDaemon(true); threadPool.setMaxThreads(threads); threadPool.setMinThreads(threads); server = new Server(threadPool); ServerConnector connector = new ServerConnector(server); connector.setHost(bindIp); connector.setPort(url.getParameter(Constants.BIND_PORT_KEY, url.getPort())); server.addConnector(connector); server.start(); } catch (Exception e) { throw new IllegalStateException("Failed to start jetty server on " + url.getParameter(Constants.BIND_IP_KEY) + ":" + url.getParameter(Constants.BIND_PORT_KEY) + ", cause: "
adminSecurePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091); final QueuedThreadPool tp = new QueuedThreadPool(); tp.setName("Jetty-QTP-AdminConsole"); adminServer = new Server(tp); adminServer.addBean(jmx.getContainer()); final ServerConnector httpConnector = new ServerConnector(adminServer, null, null, null, -1, serverThreads, new HttpConnectionFactory(httpConfig)); httpConnector.setHost(bindInterface); httpConnector.setPort(adminPort); adminServer.addConnector(httpConnector);
private void createWebServer(final Builder b) throws IOException { // Create the thread pool for the web server to handle HTTP requests QueuedThreadPool threadPool = new QueuedThreadPool(); if (b.maxThreads > 0) { threadPool.setMaxThreads(b.maxThreads); } threadPool.setDaemon(true); threadPool.setName(b.name + "-web"); this.webServer = new Server(threadPool); this.appDir = getWebAppsPath(b.name); this.webAppContext = createWebAppContext(b); if (b.useSPNEGO) { // Secure the web server with kerberos setupSpnegoFilter(b); } if (b.enableCORS) { setupCORSFilter(b); } initializeWebServer(b, threadPool.getMaxThreads()); }
/** * Set the min, max number of worker threads (simultaneous connections). */ public void setThreads(int min, int max) { QueuedThreadPool pool = (QueuedThreadPool) webServer.getThreadPool(); pool.setMinThreads(min); pool.setMaxThreads(max); }
private HttpServer(final Builder b) throws IOException { this.appDir = b.appDir; this.logDir = b.logDir; final String appDir = getWebAppsPath(b.name); int maxThreads = b.conf.getInt(HTTP_MAX_THREADS, 16); // If HTTP_MAX_THREADS is less than or equal to 0, QueueThreadPool() will use the // default value (currently 200). QueuedThreadPool threadPool = maxThreads <= 0 ? new QueuedThreadPool() : new QueuedThreadPool(maxThreads); threadPool.setDaemon(true); this.webServer = new Server(threadPool); this.adminsAcl = b.adminsAcl; this.webAppContext = createWebAppContext(b.name, b.conf, adminsAcl, appDir); this.findPort = b.findPort; initializeWebServer(b.name, b.hostName, b.conf, b.pathSpecs); }
if (job != null && _threadsIdle.get() == 0) while (isRunning()) while (job != null && isRunning()) if (LOG.isDebugEnabled()) LOG.debug("run {}", job); runJob(job); if (LOG.isDebugEnabled()) LOG.debug("ran {}", job); if (Thread.interrupted()) _threadsIdle.incrementAndGet(); while (isRunning() && job == null) final int size = _threadsStarted.get(); if (size > _minThreads) if (!shrink && isRunning()) LOG.warn("Unexpected thread death: {} in {}", this, QueuedThreadPool.this); if (_threadsStarted.decrementAndGet() < getMaxThreads()) startThreads(1); removeThread(Thread.currentThread());
if (job != null && _threadsIdle.get() == 0) loop: while (isRunning()) while (job != null && isRunning()) runJob(job); if (Thread.interrupted()) _threadsIdle.incrementAndGet(); while (isRunning() && job == null) final int size = _threadsStarted.get(); if (size > _minThreads) LOG.ignore(e); LOG.warn(e); if (!shrink && isRunning()) LOG.warn("Unexpected thread death: {} in {}",this,QueuedThreadPool.this); if (_threadsStarted.decrementAndGet()<getMaxThreads()) startThreads(1);
+ " before I started one." + "Will not attempt to start."); QueuedThreadPool threadPool = new QueuedThreadPool(); if (sourceContext.getSubProperties("QueuedThreadPool.").size() > 0) { FlumeBeanConfigurator.setConfigurationFields(threadPool, sourceContext); srv = new Server(threadPool); srv.addEventListener(mbContainer); srv.addBean(mbContainer); httpConfiguration.setSecureScheme("https"); return new ServerConnector(srv, new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpConfiguration)); }).orElse( new ServerConnector(srv, new HttpConnectionFactory(httpConfiguration)) ); connector.setPort(port); connector.setHost(host); connector.setReuseAddress(true);
int idleTimeout = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREAD_IDLE_TIMEOUT, 60000); QueuedThreadPool threadPool = queueSize > 0 ? new QueuedThreadPool(maxThreads, minThreads, idleTimeout, new ArrayBlockingQueue<>(queueSize)) : new QueuedThreadPool(maxThreads, minThreads, idleTimeout); Server server = new Server(threadPool); server.addEventListener(mbContainer); server.addBean(mbContainer); serverConnector = new ServerConnector(server, new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.toString()), new HttpConnectionFactory(httpsConfig)); } else { serverConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig)); serverConnector.setAcceptQueueSize(acceptQueueSize);
private static void setupHttpServer(int httpPort, int httpsPort) throws Exception{ QueuedThreadPool pool = new QueuedThreadPool(); pool.setMaxThreads(500); pool.start(); LoklakServer.server = new Server(pool); LoklakServer.server.setStopAtShutdown(true); ServerConnector connector = new ServerConnector(LoklakServer.server); connector.addConnectionFactory(new HttpConnectionFactory(http_config)); connector.setPort(httpPort); connector.setName("httpd:" + httpPort); connector.setIdleTimeout(20000); // timout in ms when no bytes send / received connector.start(); LoklakServer.server.addConnector(connector);
mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS); threadPool.setMinThreads(webThreadCount * 2 + 1); threadPool.setMaxThreads(webThreadCount * 2 + 100); mServer = new Server(threadPool); mServerConnector = new ServerConnector(mServer); mServerConnector.setPort(mAddress.getPort()); mServerConnector.setHost(mAddress.getAddress().getHostAddress()); mServer.addConnector(mServerConnector); mServer.setHandler(handlers);
httpSrv = new Server(new QueuedThreadPool(200, 20)); ServerConnector srvConn = new ServerConnector(httpSrv, new HttpConnectionFactory(httpCfg)); srvConn.setHost(System.getProperty(IGNITE_JETTY_HOST, "localhost")); srvConn.setPort(srvPort); srvConn.setIdleTimeout(30000L); srvConn.setReuseAddress(true); httpSrv.addConnector(srvConn); httpSrv.setStopAtShutdown(false);
final QueuedThreadPool tp = new QueuedThreadPool(processingThreads); tp.setName("Jetty-QTP-BOSH"); httpBindServer = new Server(tp); if (JMXManager.isEnabled()) { JMXManager jmx = JMXManager.getInstance(); httpBindServer.addBean(jmx.getContainer()); httpBindServer.addConnector(httpConnector);
@Override public void start() throws Exception { final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(10); threadPool.setMaxThreads(500); server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler()); server.addBean(mbeanContainer);
conf.getBytes("server.http.MaxRequestSize").toString()); QueuedThreadPool pool = conf(new QueuedThreadPool(), conf.getConfig("jetty.threads"), "jetty.threads"); Server server = new Server(pool); server.setStopAtShutdown(false); http.setPort(conf.getInt("application.port")); http.setHost(conf.getString("application.host")); https.setPort(conf.getInt("application.securePort")); server.addConnector(https);
private String startHttpServer() throws Exception { Server server = new Server(0); ((QueuedThreadPool)server.getThreadPool()).setMaxThreads(10); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/foo"); server.setHandler(context); String servletPath = "/bar"; context.addServlet(new ServletHolder(TestHttpServer.EchoServlet.class), servletPath); ((ServerConnector)server.getConnectors()[0]).setHost("localhost"); server.start(); System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); return server.getURI().toString() + servletPath; }
final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(String.format("%s (%s) Web Server", getClass().getSimpleName(), getIdentifier())); final Server server = new Server(threadPool); if (keystorePath == null) { connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration)); } else { connector = new ServerConnector(server, new SslConnectionFactory(contextFactory, "http/1.1"), new HttpConnectionFactory(httpConfiguration)); connector.setPort(port); server.setConnectors(new Connector[] {connector}); server.start(); } catch (Exception e) { shutdownHttpServer(server);
threadPool = new QueuedThreadPool(); threadPool.setMinThreads(numServerThreads); threadPool.setMaxThreads(numServerThreads); } else { threadPool = new QueuedThreadPool( numServerThreads, numServerThreads, threadPool.setDaemon(true); final Server server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true); HttpConfiguration httpConfiguration = new HttpConfiguration(); httpConfiguration.setRequestHeaderSize(config.getMaxRequestHeaderSize()); final ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration)); if (node.isBindOnHost()) { connector.setHost(node.getHost()); connector.setPort(node.getPlaintextPort()); serverConnectors.add(connector); server.setConnectors(connectors); final long gracefulStop = config.getGracefulShutdownTimeout().toStandardDuration().getMillis(); if (gracefulStop > 0) {
HttpStaticServer() { server = new Server(new QueuedThreadPool(7)); connector = new ServerConnector(server); connector.setPort(0); server.setConnectors(new Connector[] {connector}); server.setHandler( new AbstractHandler() { @Override
conf.getInt(TBoundedThreadPoolServer.MAX_WORKER_THREADS_CONF_KEY, HTTP_MAX_THREADS_KEY_DEFAULT)); QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads); threadPool.setMinThreads(minThreads); httpServer = new Server(threadPool); serverConnector = new ServerConnector(httpServer, new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.toString()), new HttpConnectionFactory(httpsConfig)); } else { serverConnector = new ServerConnector(httpServer, new HttpConnectionFactory(httpConfig)); serverConnector.setPort(listenPort); serverConnector.setHost(getBindAddress(conf).getHostAddress()); httpServer.addConnector(serverConnector); httpServer.setStopAtShutdown(true);