/** * Creates a Jetty server. * * @param maxThreads maxThreads * @param minThreads minThreads * @param threadTimeoutMillis threadTimeoutMillis * @return a new jetty server instance */ public Server create(int maxThreads, int minThreads, int threadTimeoutMillis) { Server server; if (maxThreads > 0) { int max = maxThreads; int min = (minThreads > 0) ? minThreads : 8; int idleTimeout = (threadTimeoutMillis > 0) ? threadTimeoutMillis : 60000; server = new Server(new QueuedThreadPool(max, min, idleTimeout)); } else { server = new Server(); } return server; }
QueuedThreadPool threadPool = new QueuedThreadPool(100, 10); Server server = new Server(threadPool);
@Signature public void __construct() { threadPool = new QueuedThreadPool(); server = new Server(threadPool); initSessionManager(); }
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); }
mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS);
@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
@Signature public void __construct(int port, String host) { threadPool = new QueuedThreadPool(); server = new Server(threadPool); if (host == null || host.isEmpty()) { listen(LongMemory.valueOf(port)); } else { listen(StringMemory.valueOf(host + ":" + port)); } initSessionManager(); }
@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
conf.getBytes("server.http.MaxRequestSize").toString()); QueuedThreadPool pool = conf(new QueuedThreadPool(), conf.getConfig("jetty.threads"), "jetty.threads");
private static QueuedThreadPool createQueuedThreadPool( JettyThreadCalculator jtc ) { BlockingQueue<Runnable> queue = new BlockingArrayQueue<>( jtc.getMinThreads(), jtc.getMinThreads(), jtc.getMaxCapacity() ); QueuedThreadPool threadPool = new QueuedThreadPool( jtc.getMaxThreads(), jtc.getMinThreads(), JETTY_THREAD_POOL_IDLE_TIMEOUT, queue ); threadPool.setThreadPoolBudget( null ); // mute warnings about Jetty thread pool size return threadPool; }
httpSrv = new Server(new QueuedThreadPool(200, 20));
+ " before I started one." + "Will not attempt to start."); QueuedThreadPool threadPool = new QueuedThreadPool(); if (sourceContext.getSubProperties("QueuedThreadPool.").size() > 0) { FlumeBeanConfigurator.setConfigurationFields(threadPool, sourceContext);
QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setDaemon(true); threadPool.setMaxThreads(threads);
QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setDaemon(true); threadPool.setMaxThreads(threads);
httpClient.setConnectTimeout(CLIENT_CONNECT_TIMEOUT_MILLIS); httpClient.setRequestBufferSize(config.getRequestBuffersize()); final QueuedThreadPool pool = new QueuedThreadPool(config.getNumMaxThreads()); pool.setName(JettyHttpClientModule.class.getSimpleName() + "-threadPool-" + pool.hashCode()); httpClient.setExecutor(pool);
@Before public void setUp() throws Exception { initMocks(this); when(server.getThreadPool()).thenReturn(new QueuedThreadPool(1)); Answer<Void> setHandlerMock = invocation -> { serverLevelHandler = (Handler) invocation.getArguments()[0];
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()); }
if (threadPoolSize != null && threadPoolSize instanceof Integer && (Integer) threadPoolSize > 0) { final String name = HttpClient.class.getSimpleName() + "@" + hashCode(); final QueuedThreadPool threadPool = new QueuedThreadPool((Integer) threadPoolSize); threadPool.setName(name); client.setExecutor(threadPool);
final QueuedThreadPool tp = new QueuedThreadPool(processingThreads); tp.setName("Jetty-QTP-BOSH");
public JettyServer(final NiFiProperties props, final Set<Bundle> bundles) { final QueuedThreadPool threadPool = new QueuedThreadPool(props.getWebThreads()); threadPool.setName("NiFi Web Server");