@Override synchronized public void setExecutorService(ExecutorService executorService) { if (INSTANCE.server.getThreadPool() == null) { INSTANCE.server.setThreadPool(new ExecutorThreadPool(executorService) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } }); } }
Server server = new Server(); LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueueSize); ExecutorThreadPool pool = new ExecutorThreadPool(minThreads, maxThreads, maxIdleTime, TimeUnit.MILLISECONDS, queue); server.setThreadPool(pool);
@Override synchronized public void setExecutorService(ExecutorService executorService) { if (INSTANCE.server.getThreadPool() == null) { INSTANCE.server.setThreadPool(new ExecutorThreadPool(executorService) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } }); } }
@Override synchronized public void setExecutorService(ExecutorService executorService) { if (INSTANCE.server.getThreadPool() == null) { INSTANCE.server.setThreadPool(new ExecutorThreadPool(executorService) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } }); } }
public void start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers()); server.setStopAtShutdown(true); server.start(); }
public void start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers()); server.setStopAtShutdown(true); server.start(); }
@Override protected void _start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers(createContext())); server.setStopAtShutdown(true); server.start(); }
@Override protected void _start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers(createContext())); server.setStopAtShutdown(true); server.start(); }
@Override protected void _start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers(createContext())); server.setStopAtShutdown(true); server.start(); }
@Override protected void _start() throws Exception { server = new Server(); server.setThreadPool(createThreadPool()); server.addConnector(createConnector()); server.setHandler(createHandlers(createContext())); server.setStopAtShutdown(true); server.start(); }
/** * Start Up the server */ private void startServer() { Server srv = new Server(); srv.setStopAtShutdown(true); srv.setGracefulShutdown(5000); QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMaxThreads(Integer.valueOf(configuration.getProperties().getProperty("jetty.threads.max", "250"))); srv.setThreadPool(threadPool); Connector connector = new SelectChannelConnector(); connector.setPort(port); connector.setMaxIdleTime(30000); srv.setConnectors(new Connector[]{connector}); try { List<ServletContextHandler> contexts = initialiseAndCreateContexts(); HandlerCollection handlerCollection = getHandlerCollection(srv, contexts); srv.setHandler(handlerCollection); srv.start(); srv.join(); } catch (Exception e) { log.error("Exception: ", e); e.printStackTrace(); } }
private void configureThreadPool(final CoreConfig config) { final QueuedThreadPool threadPool = new QueuedThreadPool(config.getMaxThreads()); threadPool.setMinThreads(config.getMinThreads()); threadPool.setName("http-worker"); server.setThreadPool(threadPool); }
mServer.setThreadPool(threadPool);
private void configureServer(final HttpServiceConfig config) { server.addConnector(createSelectChannelConnector(config)); server.setThreadPool(new ExecutorThreadPoolWithGracefulShutdown(config.getRequestExcecutor(), config.getGracefulShutdownTimeoutSecs())); if (config.getGracefulShutdownTimeoutSecs() > 0) { server.setGracefulShutdown(1); } final HandlerList handlerList = new HandlerList(); handlerList.setHandlers(new Handler[] { config.getHttpRequestHandler(), new DefaultHandler() }); server.setHandler(handlerList); server.setDumpAfterStart(true); server.setDumpBeforeStop(true); }
/** * Returns the wrapped Jetty server. * * @return The wrapped Jetty server. */ protected Server getWrappedServer() { if (this.wrappedServer == null) { this.wrappedServer = new WrappedServer(this); // Configuring the thread pool QueuedThreadPool btp = new QueuedThreadPool(); btp.setMaxIdleTimeMs(getThreadMaxIdleTimeMs()); btp.setMaxThreads(getMaxThreads()); btp.setMinThreads(getMinThreads()); getWrappedServer().setThreadPool(btp); if (getGracefulShutdown() > 0) { getWrappedServer().setGracefulShutdown(getGracefulShutdown()); } } return this.wrappedServer; }
setThreadPool(new QueuedThreadPool());
setThreadPool(new QueuedThreadPool());
setThreadPool(new QueuedThreadPool());
setThreadPool(new QueuedThreadPool());
aconn.getServer().setThreadPool(pool); aconn.setThreadPool(pool);