@Signature public void stopAtShutdown(boolean val) { server.setStopAtShutdown(val); }
connector.setPort(infoPort); masterJettyServer.addConnector(connector); masterJettyServer.setStopAtShutdown(true);
private void initialize() { synchronized (this.monitor) { try { // Cache the connectors and then remove them to prevent requests being // handled before the application context is ready. this.connectors = this.server.getConnectors(); this.server.addBean(new AbstractLifeCycle() { @Override protected void doStart() throws Exception { for (Connector connector : JettyWebServer.this.connectors) { Assert.state(connector.isStopped(), () -> "Connector " + connector + " has been started prematurely"); } JettyWebServer.this.server.setConnectors(null); } }); // Start the server so that the ServletContext is available this.server.start(); this.server.setStopAtShutdown(false); } catch (Throwable ex) { // Ensure process isn't left running stopSilently(); throw new WebServerException("Unable to start embedded Jetty web server", ex); } } }
@Test public void shouldSetStopAtShutdown() throws Exception { jetty9Server.configure(); verify(server).setStopAtShutdown(true); }
addDefaultServlet(wac); server.setHandler(wac); server.setStopAtShutdown(true); server.start();
server.setStopAtShutdown(false);
protected Server buildServer(LifecycleEnvironment lifecycle, ThreadPool threadPool) { final Server server = new Server(threadPool); server.addLifeCycleListener(buildSetUIDListener()); lifecycle.attach(server); final ErrorHandler errorHandler = new ErrorHandler(); errorHandler.setServer(server); errorHandler.setShowStacks(false); server.addBean(errorHandler); server.setStopAtShutdown(true); server.setStopTimeout(shutdownGracePeriod.toMilliseconds()); return server; }
serverConnector.setHost(getBindAddress(conf).getHostAddress()); httpServer.addConnector(serverConnector); httpServer.setStopAtShutdown(true);
pool.setMaxThreads(500); LoklakInstallation.server = new Server(pool); LoklakInstallation.server.setStopAtShutdown(true);
pool.start(); LoklakServer.server = new Server(pool); LoklakServer.server.setStopAtShutdown(true);
httpSrv.setStopAtShutdown(false);
server.setStopAtShutdown(true);
@Override public void configure() throws Exception { server.addEventListener(mbeans()); server.addConnector(plainConnector()); server.addConnector(sslConnector()); ContextHandlerCollection handlers = new ContextHandlerCollection(); deploymentManager.setContexts(handlers); createWebAppContext(); JettyCustomErrorPageHandler errorHandler = new JettyCustomErrorPageHandler(); webAppContext.setErrorHandler(errorHandler); webAppContext.setGzipHandler(gzipHandler()); server.addBean(errorHandler); server.addBean(deploymentManager); HandlerCollection serverLevelHandlers = new HandlerCollection(); serverLevelHandlers.setHandlers(new Handler[]{handlers}); server.setHandler(serverLevelHandlers); performCustomConfiguration(); server.setStopAtShutdown(true); }
/** * Set up server for report directory. */ private Server setUpServer() { Server server = new Server(port); ResourceHandler handler = new ResourceHandler(); handler.setDirectoriesListed(true); handler.setWelcomeFiles(new String[]{"index.html"}); handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString()); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[]{handler, new DefaultHandler()}); server.setStopAtShutdown(true); server.setHandler(handlers); return server; } }
/** * Run couchdb-lucene. */ public static void main(String[] args) throws Exception { final Config config = new Config(); final File dir = config.getDir(); final Server server = new Server(); final ServerConnector connector = new ServerConnector(server); connector.setHost(config.getConfiguration().getString("lucene.host", "localhost")); connector.setPort(config.getConfiguration().getInt("lucene.port", 5985)); LOG.info("Accepting connections with " + connector); server.addConnector(connector); server.setStopAtShutdown(true); final LuceneServlet servlet = new LuceneServlet(config.getClient(), dir, config.getConfiguration()); final ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SESSIONS | ServletContextHandler.NO_SECURITY); context.addServlet(new ServletHolder(servlet), "/*"); context.setErrorHandler(new JSONErrorHandler()); context.setGzipHandler(new GzipHandler()); server.setHandler(context); server.start(); server.join(); }
connector.setIdleTimeout(20000); // timout in ms when no bytes send / received server.addConnector(connector); server.setStopAtShutdown(true);
protected Server buildServer(LifecycleEnvironment lifecycle, ThreadPool threadPool) { final Server server = new Server(threadPool); server.addLifeCycleListener(buildSetUIDListener()); lifecycle.attach(server); final ErrorHandler errorHandler = new ErrorHandler(); errorHandler.setServer(server); errorHandler.setShowStacks(false); server.addBean(errorHandler); server.setStopAtShutdown(true); server.setStopTimeout(shutdownGracePeriod.toMilliseconds()); return server; }
server.setStopAtShutdown(true);
private Server setupServer() { Server server = new Server(new QueuedThreadPool(100)); server.setStopAtShutdown(true); return server; }
public Server create() { Log.setLog(new JavaUtilLog()); Server server = new Server(createThreadPool()); server.addBean(createClassList()); server.setStopAtShutdown(true); server.setConnectors(createConnectors(server)); return server; }