public void stop() { if (this.status.compareAndSet(Status.ACTIVE, Status.STOPPING)) { final RequestListener local = this.requestListener; if (local != null) { try { local.terminate(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } this.workerThreads.interrupt(); this.listenerExecutorService.shutdown(); this.workerExecutorService.shutdown(); } }
public void start() throws IOException { if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) { this.serverSocket = this.serverSocketFactory.createServerSocket( this.port, this.socketConfig.getBacklogSize(), this.ifAddress); this.serverSocket.setReuseAddress(this.socketConfig.isSoReuseAddress()); if (this.socketConfig.getRcvBufSize() > 0) { this.serverSocket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.sslSetupHandler != null && this.serverSocket instanceof SSLServerSocket) { this.sslSetupHandler.initialize((SSLServerSocket) this.serverSocket); } this.requestListener = new RequestListener( this.socketConfig, this.serverSocket, this.httpService, this.connectionFactory, this.exceptionLogger, this.workerExecutorService); this.listenerExecutorService.execute(this.requestListener); } }
@Override public void run() { try { while (!isTerminated() && !Thread.interrupted()) { final Socket socket = this.serversocket.accept(); socket.setSoTimeout(this.socketConfig.getSoTimeout()); socket.setKeepAlive(this.socketConfig.isSoKeepAlive()); socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay()); if (this.socketConfig.getRcvBufSize() > 0) { socket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.socketConfig.getSndBufSize() > 0) { socket.setSendBufferSize(this.socketConfig.getSndBufSize()); } if (this.socketConfig.getSoLinger() >= 0) { socket.setSoLinger(true, this.socketConfig.getSoLinger()); } final HttpServerConnection conn = this.connectionFactory.createConnection(socket); final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger); this.executorService.execute(worker); } } catch (Exception ex) { this.exceptionLogger.log(ex); } }
public void start() throws IOException { if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) { this.serverSocket = this.serverSocketFactory.createServerSocket( this.port, this.socketConfig.getBacklogSize(), this.ifAddress); this.serverSocket.setReuseAddress(this.socketConfig.isSoReuseAddress()); if (this.socketConfig.getRcvBufSize() > 0) { this.serverSocket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.sslSetupHandler != null && this.serverSocket instanceof SSLServerSocket) { this.sslSetupHandler.initialize((SSLServerSocket) this.serverSocket); } this.requestListener = new RequestListener( this.socketConfig, this.serverSocket, this.httpService, this.connectionFactory, this.exceptionLogger, this.workerExecutorService); this.listenerExecutorService.execute(this.requestListener); } }
@Override public void run() { try { while (!isTerminated() && !Thread.interrupted()) { final Socket socket = this.serversocket.accept(); socket.setSoTimeout(this.socketConfig.getSoTimeout()); socket.setKeepAlive(this.socketConfig.isSoKeepAlive()); socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay()); if (this.socketConfig.getRcvBufSize() > 0) { socket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.socketConfig.getSndBufSize() > 0) { socket.setSendBufferSize(this.socketConfig.getSndBufSize()); } if (this.socketConfig.getSoLinger() >= 0) { socket.setSoLinger(true, this.socketConfig.getSoLinger()); } final HttpServerConnection conn = this.connectionFactory.createConnection(socket); final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger); this.executorService.execute(worker); } } catch (Exception ex) { this.exceptionLogger.log(ex); } }
public void stop() { if (this.status.compareAndSet(Status.ACTIVE, Status.STOPPING)) { final RequestListener local = this.requestListener; if (local != null) { try { local.terminate(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } this.workerThreads.interrupt(); this.listenerExecutorService.shutdown(); this.workerExecutorService.shutdown(); } }
public void start() throws IOException { if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) { this.serverSocket = this.serverSocketFactory.createServerSocket( this.port, this.socketConfig.getBacklogSize(), this.ifAddress); this.serverSocket.setReuseAddress(this.socketConfig.isSoReuseAddress()); if (this.socketConfig.getRcvBufSize() > 0) { this.serverSocket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.sslSetupHandler != null && this.serverSocket instanceof SSLServerSocket) { this.sslSetupHandler.initialize((SSLServerSocket) this.serverSocket); } this.requestListener = new RequestListener( this.socketConfig, this.serverSocket, this.httpService, this.connectionFactory, this.exceptionLogger, this.workerExecutorService); this.listenerExecutorService.execute(this.requestListener); } }
@Override public void run() { try { while (!isTerminated() && !Thread.interrupted()) { final Socket socket = this.serversocket.accept(); socket.setSoTimeout(this.socketConfig.getSoTimeout()); socket.setKeepAlive(this.socketConfig.isSoKeepAlive()); socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay()); if (this.socketConfig.getRcvBufSize() > 0) { socket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.socketConfig.getSndBufSize() > 0) { socket.setSendBufferSize(this.socketConfig.getSndBufSize()); } if (this.socketConfig.getSoLinger() >= 0) { socket.setSoLinger(true, this.socketConfig.getSoLinger()); } final HttpServerConnection conn = this.connectionFactory.createConnection(socket); final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger); this.executorService.execute(worker); } } catch (Exception ex) { this.exceptionLogger.log(ex); } }
public void stop() { if (this.status.compareAndSet(Status.ACTIVE, Status.STOPPING)) { final RequestListener local = this.requestListener; if (local != null) { try { local.terminate(); } catch (IOException ex) { this.exceptionLogger.log(ex); } } this.workerThreads.interrupt(); this.listenerExecutorService.shutdown(); this.workerExecutorService.shutdown(); } }
public void start() throws IOException { if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) { this.serverSocket = this.serverSocketFactory.createServerSocket( this.port, this.socketConfig.getBacklogSize(), this.ifAddress); this.serverSocket.setReuseAddress(this.socketConfig.isSoReuseAddress()); if (this.socketConfig.getRcvBufSize() > 0) { this.serverSocket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.sslSetupHandler != null && this.serverSocket instanceof SSLServerSocket) { this.sslSetupHandler.initialize((SSLServerSocket) this.serverSocket); } this.requestListener = new RequestListener( this.socketConfig, this.serverSocket, this.httpService, this.connectionFactory, this.exceptionLogger, this.workerExecutorService); this.listenerExecutorService.execute(this.requestListener); } }
@Override public void run() { try { while (!isTerminated() && !Thread.interrupted()) { final Socket socket = this.serversocket.accept(); socket.setSoTimeout(this.socketConfig.getSoTimeout()); socket.setKeepAlive(this.socketConfig.isSoKeepAlive()); socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay()); if (this.socketConfig.getRcvBufSize() > 0) { socket.setReceiveBufferSize(this.socketConfig.getRcvBufSize()); } if (this.socketConfig.getSndBufSize() > 0) { socket.setSendBufferSize(this.socketConfig.getSndBufSize()); } if (this.socketConfig.getSoLinger() >= 0) { socket.setSoLinger(true, this.socketConfig.getSoLinger()); } final HttpServerConnection conn = this.connectionFactory.createConnection(socket); final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger); this.executorService.execute(worker); } } catch (final Exception ex) { this.exceptionLogger.log(ex); } }
public void stop() { if (this.status.compareAndSet(Status.ACTIVE, Status.STOPPING)) { this.listenerExecutorService.shutdown(); this.workerExecutorService.shutdown(); final RequestListener local = this.requestListener; if (local != null) { try { local.terminate(); } catch (final IOException ex) { this.exceptionLogger.log(ex); } } this.workerThreads.interrupt(); } }