public void stop() { if (null != server) { server.stop(); server = null; } }
@Override public void run() { System.out.println("Stopping HTTP Server..."); server.stop(); } }.start();
@After public void tearDown() { if (localServer != null) { localServer.stop(); } }
public void shutdown(final long gracePeriod, final TimeUnit timeUnit) { stop(); if (gracePeriod > 0) { try { awaitTermination(gracePeriod, timeUnit); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } final List<Runnable> runnables = this.workerExecutorService.shutdownNow(); for (Runnable runnable: runnables) { if (runnable instanceof Worker) { final Worker worker = (Worker) runnable; final HttpServerConnection conn = worker.getConnection(); try { conn.shutdown(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } } }
public void shutdown(final long gracePeriod, final TimeUnit timeUnit) { stop(); if (gracePeriod > 0) { try { awaitTermination(gracePeriod, timeUnit); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } final List<Runnable> runnables = this.workerExecutorService.shutdownNow(); for (Runnable runnable: runnables) { if (runnable instanceof Worker) { final Worker worker = (Worker) runnable; final HttpServerConnection conn = worker.getConnection(); try { conn.shutdown(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } } }
public void shutdown(final long gracePeriod, final TimeUnit timeUnit) { stop(); if (gracePeriod > 0) { try { awaitTermination(gracePeriod, timeUnit); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } final List<Runnable> runnables = this.workerExecutorService.shutdownNow(); for (Runnable runnable: runnables) { if (runnable instanceof Worker) { final Worker worker = (Worker) runnable; final HttpServerConnection conn = worker.getConnection(); try { conn.shutdown(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } } }
public void shutdown(final long gracePeriod, final TimeUnit timeUnit) { stop(); if (gracePeriod > 0) { try { awaitTermination(gracePeriod, timeUnit); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); } } final Set<Worker> workers = this.workerExecutorService.getWorkers(); for (final Worker worker: workers) { final HttpServerConnection conn = worker.getConnection(); try { conn.shutdown(); } catch (final IOException ex) { this.exceptionLogger.log(ex); } } }