protected void signalCloseDone() { closeFuture.get().set(null); // We can now close the socket if (incomingConnection != null) { //this will close the underlying socket and remove it //from active MessagingService connections (CASSANDRA-11854) incomingConnection.close(); } else { //this is an outgoing connection not registered in the MessagingService //so we can close the socket directly try { socket.close(); } catch (IOException e) { // Erroring out while closing shouldn't happen but is not really a big deal, so just log // it at DEBUG and ignore otherwise. logger.debug("Unexpected error while closing streaming connection", e); } } } }
? new IncomingStreamingConnection(version, socket, connections) : new IncomingTcpConnection(version, MessagingService.getBits(header, 2, 1) == 1, socket, connections); thread.start();
? new IncomingStreamingConnection(version, socket, connections) : new IncomingTcpConnection(version, MessagingService.getBits(header, 2, 1) == 1, socket, connections); thread.start();
protected void signalCloseDone() { if (!isClosed()) close(); closeFuture.get().set(null); // We can now close the socket if (incomingConnection != null) { //this will close the underlying socket and remove it //from active MessagingService connections (CASSANDRA-11854) incomingConnection.close(); } else { //this is an outgoing connection not registered in the MessagingService //so we can close the socket directly try { socket.close(); } catch (IOException e) { // Erroring out while closing shouldn't happen but is not really a big deal, so just log // it at DEBUG and ignore otherwise. logger.debug("Unexpected error while closing streaming connection", e); } } } }
? new IncomingStreamingConnection(version, socket, connections) : new IncomingTcpConnection(version, MessagingService.getBits(header, 2, 1) == 1, socket, connections); thread.start();
protected void signalCloseDone() { if (!isClosed()) close(); closeFuture.get().set(null); // We can now close the socket if (incomingConnection != null) { //this will close the underlying socket and remove it //from active MessagingService connections (CASSANDRA-11854) incomingConnection.close(); } else { //this is an outgoing connection not registered in the MessagingService //so we can close the socket directly try { socket.close(); } catch (IOException e) { // Erroring out while closing shouldn't happen but is not really a big deal, so just log // it at DEBUG and ignore otherwise. logger.debug("Unexpected error while closing streaming connection", e); } } } }
? new IncomingStreamingConnection(version, socket, connections) : new IncomingTcpConnection(version, MessagingService.getBits(header, 2, 1) == 1, socket, connections); thread.start();
@Override public void run() { try { // streaming connections are per-session and have a fixed version. we can't do anything with a wrong-version stream connection, so drop it. if (version != StreamMessage.CURRENT_VERSION) throw new IOException(String.format("Received stream using protocol version %d (my version %d). Terminating connection", version, MessagingService.current_version)); DataInput input = new DataInputStream(socket.getInputStream()); StreamInitMessage init = StreamInitMessage.serializer.deserialize(input, version); //Set SO_TIMEOUT on follower side if (!init.isForOutgoing) socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout()); // The initiator makes two connections, one for incoming and one for outgoing. // The receiving side distinguish two connections by looking at StreamInitMessage#isForOutgoing. // Note: we cannot use the same socket for incoming and outgoing streams because we want to // parallelize said streams and the socket is blocking, so we might deadlock. StreamResultFuture.initReceivingSide(init.sessionIndex, init.planId, init.description, init.from, this, init.isForOutgoing, version); } catch (IOException e) { logger.debug("IOException reading from socket; closing", e); close(); } }
@Override @SuppressWarnings("resource") // Not closing constructed DataInputPlus's as the stream needs to remain open. public void run() { try { // streaming connections are per-session and have a fixed version. // we can't do anything with a wrong-version stream connection, so drop it. if (version != StreamMessage.CURRENT_VERSION) throw new IOException(String.format("Received stream using protocol version %d (my version %d). Terminating connection", version, StreamMessage.CURRENT_VERSION)); DataInputPlus input = new DataInputStreamPlus(socket.getInputStream()); StreamInitMessage init = StreamInitMessage.serializer.deserialize(input, version); //Set SO_TIMEOUT on follower side if (!init.isForOutgoing) socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout()); // The initiator makes two connections, one for incoming and one for outgoing. // The receiving side distinguish two connections by looking at StreamInitMessage#isForOutgoing. // Note: we cannot use the same socket for incoming and outgoing streams because we want to // parallelize said streams and the socket is blocking, so we might deadlock. StreamResultFuture.initReceivingSide(init.sessionIndex, init.planId, init.description, init.from, this, init.isForOutgoing, version, init.keepSSTableLevel, init.isIncremental); } catch (Throwable t) { logger.error("Error while reading from socket from {}.", socket.getRemoteSocketAddress(), t); close(); } }
@Override @SuppressWarnings("resource") // Not closing constructed DataInputPlus's as the stream needs to remain open. public void run() { try { // streaming connections are per-session and have a fixed version. // we can't do anything with a wrong-version stream connection, so drop it. if (version != StreamMessage.CURRENT_VERSION) throw new IOException(String.format("Received stream using protocol version %d (my version %d). Terminating connection", version, StreamMessage.CURRENT_VERSION)); DataInputPlus input = new DataInputStreamPlus(socket.getInputStream()); StreamInitMessage init = StreamInitMessage.serializer.deserialize(input, version); //Set SO_TIMEOUT on follower side if (!init.isForOutgoing) socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout()); // The initiator makes two connections, one for incoming and one for outgoing. // The receiving side distinguish two connections by looking at StreamInitMessage#isForOutgoing. // Note: we cannot use the same socket for incoming and outgoing streams because we want to // parallelize said streams and the socket is blocking, so we might deadlock. StreamResultFuture.initReceivingSide(init.sessionIndex, init.planId, init.description, init.from, this, init.isForOutgoing, version, init.keepSSTableLevel, init.isIncremental); } catch (Throwable t) { logger.error("Error while reading from socket from {}.", socket.getRemoteSocketAddress(), t); close(); } }
protected void signalCloseDone() { if (!isClosed()) close(); closeFuture.get().set(null); // We can now close the socket if (incomingConnection != null) { //this will close the underlying socket and remove it //from active MessagingService connections (CASSANDRA-11854) incomingConnection.close(); } else { //this is an outgoing connection not registered in the MessagingService //so we can close the socket directly try { socket.close(); } catch (IOException e) { // Erroring out while closing shouldn't happen but is not really a big deal, so just log // it at DEBUG and ignore otherwise. logger.debug("Unexpected error while closing streaming connection", e); } } } }
@Override @SuppressWarnings("resource") // Not closing constructed DataInputPlus's as the stream needs to remain open. public void run() { try { // streaming connections are per-session and have a fixed version. // we can't do anything with a wrong-version stream connection, so drop it. if (version != StreamMessage.CURRENT_VERSION) throw new IOException(String.format("Received stream using protocol version %d (my version %d). Terminating connection", version, StreamMessage.CURRENT_VERSION)); DataInputPlus input = new DataInputStreamPlus(socket.getInputStream()); StreamInitMessage init = StreamInitMessage.serializer.deserialize(input, version); //Set SO_TIMEOUT on follower side if (!init.isForOutgoing) socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout()); // The initiator makes two connections, one for incoming and one for outgoing. // The receiving side distinguish two connections by looking at StreamInitMessage#isForOutgoing. // Note: we cannot use the same socket for incoming and outgoing streams because we want to // parallelize said streams and the socket is blocking, so we might deadlock. StreamResultFuture.initReceivingSide(init.sessionIndex, init.planId, init.description, init.from, this, init.isForOutgoing, version, init.keepSSTableLevel, init.isIncremental); } catch (Throwable t) { logger.error("Error while reading from socket from {}.", socket.getRemoteSocketAddress(), t); close(); } }