/** * Polls for accepted sockets */ protected void handle() { if (inboundAcceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(inboundAcceptor.getServiceExitedWithException()); } if (outboundAcceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(outboundAcceptor.getServiceExitedWithException()); } try { ActiveConnection conn = acceptConnection(queue.poll(2, TimeUnit.SECONDS)); if (conn != null) { log.info("Accepted connection from " + conn.getRemoteAddress().getHostAddress()); newConnection(conn); } } catch (Exception e) { log.error("Error while accepting connections: ", e); } }
/** * Polls for accepted sockets */ protected void handle() { if (inboundAcceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(inboundAcceptor.getServiceExitedWithException()); } if (outboundAcceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(outboundAcceptor.getServiceExitedWithException()); } try { ActiveConnection conn = acceptConnection(queue.poll(2, TimeUnit.SECONDS)); if (conn != null) { log.info("Accepted connection from " + conn.getRemoteAddress().getHostAddress()); newConnection(conn); } } catch (Exception e) { log.error("Error while accepting connections: ", e); } }
/** * Loop that waits for a connection and starts a ConnectionManager when it * gets one. */ @Override protected void handle() { if (acceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(acceptor.getServiceExitedWithException()); } try { // Wait some period of time for connections AcceptedSocket newSocket = queue.poll(500, TimeUnit.MILLISECONDS); if (newSocket != null) { log.info("Accepted connection from {}:{} on local port {}", new Object[] { newSocket.socket.getInetAddress().getHostAddress(), newSocket.socket.getPort(), port }); ActiveConnection c = new ActiveConnection(getParser(), getLlp(), newSocket.socket, getExecutorService()); newConnection(c); } } catch (InterruptedException ie) { // just timed out } catch (Exception e) { log.error("Error while accepting connections: ", e); } }
/** * Loop that waits for a connection and starts a ConnectionManager when it * gets one. */ @Override protected void handle() { if (acceptor.getServiceExitedWithException() != null) { setServiceExitedWithException(acceptor.getServiceExitedWithException()); } try { // Wait some period of time for connections AcceptedSocket newSocket = queue.poll(500, TimeUnit.MILLISECONDS); if (newSocket != null) { log.info("Accepted connection from {}:{} on local port {}", new Object[] { newSocket.socket.getInetAddress().getHostAddress(), newSocket.socket.getPort(), port }); ActiveConnection c = new ActiveConnection(getParser(), getLlp(), newSocket.socket, getExecutorService()); newConnection(c); } } catch (InterruptedException ie) { // just timed out } catch (Exception e) { log.error("Error while accepting connections: ", e); } }