webapp.setInitParams(initParams); server.setHandler(webapp); server.setStopAtShutdown(true); server.start();
public JettySolandraRunner( String context, int port, String host) { this.context = context; server = new Server( port ); server.getConnectors()[0].setHost(host); server.setStopAtShutdown( true ); // Initialize the servlets Context root = new Context( server, context, Context.SESSIONS ); // for some reason, there must be a servlet for this to get applied root.addServlet( Servlet404.class, "/*" ); dispatchFilter = root.addFilter( SolandraDispatchFilter.class, "*", Handler.REQUEST ); }
server.setStopAtShutdown(false);
@Override public void destroy() { try { server.stop(); server.setStopAtShutdown(false); server.destroy(); } catch (Exception e) { throw new TestException(e.getMessage(), e); } finally { session = null; server = null; } }
/** * Stop all the started servers. */ public void stop() { synchronized (joinLock) { joinLock.notifyAll(); } try { Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet()); for (Entry<Integer, Port> entry : entries) { Port port = entry.getValue(); Server server = port.getServer(); server.stop(); server.setStopAtShutdown(false); ports.remove(entry.getKey()); } } catch (Exception e) { throw new ServletMappingException(e); } finally { if (jettyLogger != null) { Log.setLog(jettyLogger); jettyLogger = null; } } }
/** * Stop all the started servers. */ public void stop() { synchronized (joinLock) { joinLock.notifyAll(); } try { Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet()); for (Entry<Integer, Port> entry : entries) { Port port = entry.getValue(); Server server = port.getServer(); server.stop(); server.setStopAtShutdown(false); ports.remove(entry.getKey()); } } catch (Exception e) { throw new ServletMappingException(e); } finally { if (jettyLogger != null) { Log.setLog(jettyLogger); jettyLogger = null; } } }
private void init( String context, int port ) { this.context = context; server = new Server( port ); server.setStopAtShutdown( true ); // Initialize the servlets Context root = new Context( server, context, Context.SESSIONS ); // for some reason, there must be a servlet for this to get applied root.addServlet( Servlet404.class, "/*" ); dispatchFilter = root.addFilter( SolrDispatchFilter.class, "*", Handler.REQUEST ); }
public void stop() throws StoppingException { try { getServer().stop(); // NEXUS-2465 memory leak here, since jetty is already stopped but kept in memory by shutdown hook getServer().setStopAtShutdown( false ); setServer( null ); PlexusContainerHolder.clear(); } catch ( Exception e ) { throw new StoppingException( "Error stopping embedded Jetty server.", e ); } }
@Before public void setUp() throws Exception { metricsMap.put("FreeSpace", "10GB"); metricsMap.put("UsedSpace", "90GB"); metricsMap.put("maps_killed", "20"); jettyServer = new Server(9090); Context root = new Context(jettyServer, "/metrics/instrumentation/data", Context.SESSIONS); root.addServlet(new ServletHolder(new RestServlet()), "/*"); System.out.println(" Rest Server starting.."); jettyServer.start(); jettyServer.setStopAtShutdown(true); }
protected Server createJettyServer(Site site){ Server server = new Server(); server.setStopAtShutdown(true);
server.setStopAtShutdown(false); Thread.sleep(1000); agent.processAddCommand("add adaptor_constSend = " + ConstRateAdaptor.class.getCanonicalName() +
server.setStopAtShutdown(true); } catch (Exception e) { throw new TestException(e.getMessage(), e);
public void start() throws Exception { this.server = new Server(this.port); WebAppContext root = new WebAppContext(); root.setContextPath("/"); root.setDescriptor(webappDirLocation + "/web.xml"); root.setResourceBase(webappDirLocation); root.setParentLoaderPriority(true); this.server.setHandler(root); this.server.setStopAtShutdown(true); this.server.start(); databaseServer = org.h2.tools.Server.createTcpServer(new String[]{"-tcpAllowOthers"}).start(); this.server.join(); }
@Override public void stop() throws UnableToCompleteException { TreeLogger branch = logger.branch(TreeLogger.INFO, "Stopping Jetty server"); // Temporarily log Jetty on the branch. Log.setLog(new JettyTreeLogger(branch)); try { server.stop(); server.setStopAtShutdown(false); branch.log(TreeLogger.TRACE, "Stopped successfully"); } catch (Exception e) { branch.log(TreeLogger.ERROR, "Unable to stop embedded Jetty server", e); throw new UnableToCompleteException(); } finally { // Reset the top-level logger. Log.setLog(new JettyTreeLogger(logger)); } } }
server.setStopAtShutdown(true); server.start();
jettyServer.setStopAtShutdown(true);
public static Server startCollectorOnPort(Configuration conf, int port, ServletCollector collector) throws Exception { Server server = new Server(port); Context root = new Context(server, "/", Context.SESSIONS); root.addServlet(new ServletHolder(collector), "/*"); root.addServlet(new ServletHolder(new CommitCheckServlet(conf)), "/"+CommitCheckServlet.DEFAULT_PATH); server.start(); server.setStopAtShutdown(false); return server; }
@Override protected void startUp() throws Exception { // setup the jetty config ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest"); sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); server = new Server(); Connector connector = new SelectChannelConnector(); connector.setPort(this.port); connector.setHost(address); server.addConnector(connector); // TODO: in the future we may want to provide settings for the min and max threads // Jetty sets the default max thread number to 250, if we don't set it. // QueuedThreadPool threadPool = new QueuedThreadPool(); server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // set up context Context context = new Context(server, "/", Context.SESSIONS); context.addServlet(sh, "/*"); // start server server.start(); }
@Override protected void startUp() throws Exception { // setup the jetty config ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest"); sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); server = new Server(); Connector connector = new SelectChannelConnector(); connector.setPort(this.port); connector.setHost(address); server.addConnector(connector); // TODO: in the future we may want to provide settings for the min and max threads // Jetty sets the default max thread number to 250, if we don't set it. // QueuedThreadPool threadPool = new QueuedThreadPool(); server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // set up context Context context = new Context(server, "/", Context.SESSIONS); context.addServlet(sh, "/*"); // start server server.start(); }