public static void shutdown(int exitcode){ DAO.severe("Shutting down installation now"); server.setStopTimeout(0); System.exit(exitcode); } }
private static void waitOnExit(Server server) throws Exception { File exit = new File(SysJMX.getProcessPID() + ".scouter"); try { exit.createNewFile(); } catch (Exception e) { String tmp = System.getProperty("user.home", "/tmp"); exit = new File(tmp, SysJMX.getProcessPID() + ".scouter.run"); try { exit.createNewFile(); } catch (Exception k) { System.exit(1); } } exit.deleteOnExit(); System.out.println("System JRE version : " + System.getProperty("java.version")); while (true) { if (exit.exists() == false) { server.setStopTimeout(3000); server.stop(); System.exit(0); } ThreadUtil.sleep(1000); } }
@Override protected void resetInternal() { try { if (this.jettyServer.isRunning()) { this.jettyServer.setStopTimeout(5000); this.jettyServer.stop(); this.jettyServer.destroy(); } } catch (Exception ex) { throw new IllegalStateException(ex); } finally { this.jettyServer = null; this.contextHandler = null; } }
@Override public void stop() throws Exception { try { if (this.contextHandler.isRunning()) { this.contextHandler.stop(); } } finally { if (this.jettyServer.isRunning()) { this.jettyServer.setStopTimeout(5000); this.jettyServer.stop(); } } }
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; }
@Override protected void stopInternal() throws Exception { try { if (this.contextHandler.isRunning()) { this.contextHandler.stop(); } } finally { try { if (this.jettyServer.isRunning()) { this.jettyServer.setStopTimeout(5000); this.jettyServer.stop(); this.jettyServer.destroy(); } } catch (Exception ex) { // ignore } } }
final long gracefulStop = config.getGracefulShutdownTimeout().toStandardDuration().getMillis(); if (gracefulStop > 0) { server.setStopTimeout(gracefulStop);
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; }
@PreDestroy public void stop() throws Exception { server.setStopTimeout(0); server.stop(); }
public void start() { try { Server server = new Server(this.port); WSHandler.setProcessor(eventProcessor); server.setHandler(new WSHandler()); server.setStopTimeout(0); server.start(); server.join(); } catch (Exception ex) { logger.error(ex); } }
YourServletHandler servletHandler = new YourServletHandler(); StatisticsHandler statsHandler = new StatisticsHandler(); statsHandler.setHandler(servletHandler); Server server = new Server(80); server.setHandler(statsHandler); server.setStopTimeout(3000L); //... server.start(); //... server.stop();
protected void finalizeSetup(Options options) { if(!options.jettySettings().getStopTimeout().isPresent()) { jettyServer.setStopTimeout(0); } }
public Connector createConnector(Server server) throws Exception { ServerConnector connector = new ServerConnector(server); server.setStopTimeout(500); connector.setStopTimeout(500); if (transportOptions != null) { IntrospectionSupport.setProperties(connector, transportOptions, ""); } return connector; }
public Connector createConnector(Server server) throws Exception { ServerConnector connector = new ServerConnector(server); server.setStopTimeout(500); connector.setStopTimeout(500); if (transportOptions != null) { IntrospectionSupport.setProperties(connector, transportOptions, ""); } return connector; }
public Connector createConnector(Server server) throws Exception { ServerConnector connector = new ServerConnector(server); server.setStopTimeout(500); connector.setStopTimeout(500); if (transportOptions != null) { IntrospectionSupport.setProperties(connector, transportOptions, ""); } return connector; }
@AfterMethod(alwaysRun = true) public void abstractTeardown() throws Exception { if (server != null) { server.setStopTimeout(3000); server.stop(); } }
@AfterMethod(alwaysRun = true) public void abstractTeardown() throws Exception { if (server != null) { server.setStopTimeout(3000); server.stop(); } }
protected Server createServer(Options options) { final Server server = new Server(options.threadPoolFactory().buildThreadPool(options)); final JettySettings jettySettings = options.jettySettings(); final Optional<Long> stopTimeout = jettySettings.getStopTimeout(); if(stopTimeout.isPresent()) { server.setStopTimeout(stopTimeout.get()); } return server; }
private Server initServer() { Server server = new Server(configuration.getPort()); server.setStopAtShutdown(configuration.isStopAtShutdown()); server.setStopTimeout(configuration.getStopTimeout()); return server; }
public static Server start(int port) throws Exception { Server server = new Server(port); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); String resourcePath = JettyServer.class.getPackage().getName().replace('.', '/'); webapp.setBaseResource(Resource.newClassPathResource(resourcePath)); webapp.setParentLoaderPriority(true); server.setHandler(webapp); server.setStopTimeout(5000); server.start(); return server; }