void initServerConfig(final MockedServerConfigDTO config) { logger.debug("initServerConfig called"); if (logger.isDebugEnabled()) logger.debug(config.toString()); Spark.port(config.getPort()); Spark.threadPool(config.getMaxThreads(), config.getMinThreads(), config.getTimeOutMillis()); }
@Override protected void executeInternal() throws Exception { setupStageVariables(); loadPathHandlers(); port(serverPort); threadPool(8); setupServer(); awaitInitialization(); getLog().info(format("Server is alive on http://%s:%d/%s/", "127.0.0.1", this.serverPort, this.stageName)); while (10 != System.in.read()) { Thread.sleep(500); } stop(); }
@Override public void execute() throws MojoExecutionException { try { printLogo(); getLog().info(LOG_SEPERATOR); getLog().info("Starting web server at port " + serverPort); port(serverPort); threadPool(8); setUpServer(); awaitInitialization(); while (10 != System.in.read()) { Thread.sleep(500); } stop(); } catch (Exception e) { throw new MojoExecutionException("Exception at deployment", e); } }
threadPool(16, 2, 5000); ipAddress(host); port(port);
public static void main(String[] args) { int maxThreads = 32; int minThreads = 2; int timeOutMillis = 30000; threadPool(maxThreads, minThreads, timeOutMillis); get("/", EC2SampleApp::hello); get("/cpu", EC2SampleApp::cpu); get("/ram", EC2SampleApp::ram); get("/ram/info", EC2SampleApp::ramInfo); get("/ram/clean", EC2SampleApp::ramClean); get("/health", EC2SampleApp::health); get("/health/flip", EC2SampleApp::flipHealth); get("/details", EC2SampleApp::details); }
public void start() { Spark.ipAddress(config.bindHost()); Spark.port(config.bindPort()); Spark.threadPool(config.threadNum()); Spark.staticFileLocation("/static"); if (!config.readonly()) { this.initWritableHandlers(); } this.initReadonlyHandlers(); this.initViewHandlers(); this.initExceptionHandlers(); Spark.awaitInitialization(); LOG.warn("captain server started"); }