udpSender = null; stop(); if(!bridgeSettings.getBridgeControl().isStop()) { try {
public void stop() { Spark.stop(); } }
public void stop() { Spark.stop(); }
@Nonnull public MonitorServer shutdown() { Spark.stop(); return this; }
@Override public void stop() { LOGGER.info("Stopping HttpHealthCheckEndpoint."); Spark.stop(); }
@Override protected void after() { this.sparkApplication.destroy(); Spark.stop(); }
/** * the auto update process * * @param request * @param response * @return */ private String update(Request request, Response response) { ExecutorService exec = Executors.newSingleThreadExecutor(); exec.execute(() -> { try { logger.info("Downloading last version"); File latestVersion = updater.downloadLatestVersion(); logger.info("Latest version downloaded : [{}]", latestVersion.getAbsolutePath()); //Stopping the server so we can update peacefully if (updater.isFolderStructureOkForAutoUpdate()) { Spark.stop(); try { updater.stopHomedashAndTriggerUpdate(latestVersion.toPath().toAbsolutePath()); } catch (Exception e) { logger.error("error while updating, restarting Spark", e); Spark.init(); } } } catch (Exception e) { logger.error("Error while downloading the latest version", e); } }); return "Homedash is updating and will restart on its own, try to stay still."; }
@AfterClass public static void stopServer() { Spark.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); } }
@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(); }
Spark.stop(); serverIsStarted = false; } else {
public void halt() { if (this.watcher.isAlive()) { this.watcher.interrupt(); this.watcher.quit(); } this.redis.close(); Spark.stop(); } }
Spark.stop(); serverIsStarted = false; } else {
@Override public void shutdown() throws MockServerException { try { serverSideEventService.interruptAndClearAllHeartBeatThreads(); Spark.stop(); // Having dug around the source code, 'Spark.stop()' runs off a different thread when stopping the server and removing it's state such as routes, etc. // This means that calling 'Spark.port()' immediately after stop, results in an IllegalStateException, as the // 'initialized' flag is checked in the current thread and is still marked as true. // (The error thrown: java.lang.IllegalStateException: This must be done before route mapping has begun) // Short of editing the Spark source to fix this, I have therefore had to add this hack to buy the 'stop' thread time to complete. Thread.sleep(3000); synchronized (monitor) { serverState.setRunning(false); } clearState(); proxyServer.shutdown(); } catch (Throwable ex) { throw new MockServerException(ex); } finally { clearDeployedMocks(); } }