public void startAndWait() { start(); try { waitTillShutdown(); } catch (InterruptedException e) { Thread.interrupted(); } }
/** * A catch all error handler which gets invoked if any error happens during connection handling by the configured * {@link ConnectionHandler}. * * @param errorHandler Error handler to invoke when {@link ConnectionHandler} threw an error. * * @return This server instance. */ public S withErrorHandler(ErrorHandler errorHandler) { if (serverStateRef.get() == ServerState.Started) { throw new IllegalStateException("Error handler can not be set after starting the server."); } this.errorHandler = errorHandler; return returnServer(); }
@Override public void waitTillShutdown() { try { rxNettyServer.waitTillShutdown(); } catch (InterruptedException e) { logger.error("Interrupted while waiting for shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
@Override protected void _start() { rxNettyServer.start(); }
public S start() { if (!serverStateRef.compareAndSet(ServerState.Created, ServerState.Starting)) { throw new IllegalStateException("Server already started"); } try { bindFuture = bootstrap.bind(port).sync(); if (!bindFuture.isSuccess()) { throw new RuntimeException(bindFuture.cause()); } } catch (InterruptedException e) { throw new RuntimeException(e); } serverStateRef.set(ServerState.Started); // It will come here only if this was the thread that transitioned to Starting logger.info("Rx server started at port: " + getServerPort()); return returnServer(); }
@Override public void shutdown() { super.shutdown(); try { rxNettyServer.shutdown(); } catch (InterruptedException e) { logger.error("Interrupted while shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
MetricEventsListener<? extends ServerMetricsEvent<?>> listener = newMetricsListener(eventListenersFactory, server); server.subscribe(listener);
@Override public void waitTillShutdown() { try { rxNettyServer.waitTillShutdown(); } catch (InterruptedException e) { logger.error("Interrupted while waiting for shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
@Override protected void _start() { rxNettyServer.start(); }
public S start() { if (!serverStateRef.compareAndSet(ServerState.Created, ServerState.Starting)) { throw new IllegalStateException("Server already started"); } try { bindFuture = bootstrap.bind(port).sync(); if (!bindFuture.isSuccess()) { throw new RuntimeException(bindFuture.cause()); } } catch (InterruptedException e) { throw new RuntimeException(e); } serverStateRef.set(ServerState.Started); // It will come here only if this was the thread that transitioned to Starting logger.info("Rx server started at port: " + getServerPort()); return returnServer(); }
@Override public void shutdown() { super.shutdown(); try { rxNettyServer.shutdown(); } catch (InterruptedException e) { logger.error("Interrupted while shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
MetricEventsListener<? extends ServerMetricsEvent<?>> listener = newMetricsListener(eventListenersFactory, server); server.subscribe(listener);
public void startAndWait() { start(); try { waitTillShutdown(); } catch (InterruptedException e) { Thread.interrupted(); } }
@Override public void waitTillShutdown() { try { rxNettyServer.waitTillShutdown(); } catch (InterruptedException e) { logger.error("Interrupted while waiting for shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
@Override protected void _start() { rxNettyServer.start(); }
@Override public void shutdown() { super.shutdown(); try { rxNettyServer.shutdown(); } catch (InterruptedException e) { logger.error("Interrupted while shutdown.", e); Thread.interrupted(); throw new RuntimeException(e); } }
/** * A catch all error handler which gets invoked if any error happens during connection handling by the configured * {@link ConnectionHandler}. * * @param errorHandler Error handler to invoke when {@link ConnectionHandler} threw an error. * * @return This server instance. */ public S withErrorHandler(ErrorHandler errorHandler) { if (serverStateRef.get() == ServerState.Started) { throw new IllegalStateException("Error handler can not be set after starting the server."); } this.errorHandler = errorHandler; return returnServer(); }