public ListenableFuture<?> closeIncoming() { return incoming == null ? Futures.immediateFuture(null) : incoming.close(); }
/** * Set up incoming message handler and initiate streaming. * * This method is called once on initiator. * * @throws IOException */ public void initiate() throws IOException { logger.debug("[Stream #{}] Sending stream init for incoming stream", session.planId()); Socket incomingSocket = session.createConnection(); incoming.start(incomingSocket, StreamMessage.CURRENT_VERSION); incoming.sendInitMessage(incomingSocket, true); logger.debug("[Stream #{}] Sending stream init for outgoing stream", session.planId()); Socket outgoingSocket = session.createConnection(); outgoing.start(outgoingSocket, StreamMessage.CURRENT_VERSION); outgoing.sendInitMessage(outgoingSocket, false); }
ReadableByteChannel in = getReadChannel(socket); while (!isClosed()) close(); signalCloseDone();
@SuppressWarnings("resource") public void run() { try { ReadableByteChannel in = getReadChannel(socket); while (!isClosed()) { // receive message StreamMessage message = StreamMessage.deserialize(in, protocolVersion, session); logger.debug("[Stream #{}] Received {}", session.planId(), message); // Might be null if there is an error during streaming (see FileMessage.deserialize). It's ok // to ignore here since we'll have asked for a retry. if (message != null) { session.messageReceived(message); } } } catch (Throwable t) { JVMStabilityInspector.inspectThrowable(t); session.onError(t); } finally { signalCloseDone(); } } }
@SuppressWarnings("resource") public void run() { try { ReadableByteChannel in = getReadChannel(socket); while (!isClosed()) { // receive message StreamMessage message = StreamMessage.deserialize(in, protocolVersion, session); logger.debug("[Stream #{}] Received {}", session.planId(), message); // Might be null if there is an error during streaming (see FileMessage.deserialize). It's ok // to ignore here since we'll have asked for a retry. if (message != null) { session.messageReceived(message); } } } catch (Throwable t) { JVMStabilityInspector.inspectThrowable(t); session.onError(t); } finally { signalCloseDone(); } } }
@SuppressWarnings("resource") public void run() { try { ReadableByteChannel in = getReadChannel(socket); while (!isClosed()) { // receive message StreamMessage message = StreamMessage.deserialize(in, protocolVersion, session); logger.debug("[Stream #{}] Received {}", session.planId(), message); // Might be null if there is an error during streaming (see FileMessage.deserialize). It's ok // to ignore here since we'll have asked for a retry. if (message != null) { session.messageReceived(message); } } } catch (Throwable t) { JVMStabilityInspector.inspectThrowable(t); session.onError(t); } finally { signalCloseDone(); } } }
/** * Set up incoming message handler and initiate streaming. * * This method is called once on initiator. * * @throws IOException */ @SuppressWarnings("resource") public void initiate() throws IOException { logger.debug("[Stream #{}] Sending stream init for incoming stream", session.planId()); Socket incomingSocket = session.createConnection(); incoming.start(incomingSocket, StreamMessage.CURRENT_VERSION, true); logger.debug("[Stream #{}] Sending stream init for outgoing stream", session.planId()); Socket outgoingSocket = session.createConnection(); outgoing.start(outgoingSocket, StreamMessage.CURRENT_VERSION, true); }
/** * Set up incoming message handler and initiate streaming. * * This method is called once on initiator. * * @throws IOException */ @SuppressWarnings("resource") public void initiate() throws IOException { logger.debug("[Stream #{}] Sending stream init for incoming stream", session.planId()); Socket incomingSocket = session.createConnection(); incoming.start(incomingSocket, StreamMessage.CURRENT_VERSION, true); logger.debug("[Stream #{}] Sending stream init for outgoing stream", session.planId()); Socket outgoingSocket = session.createConnection(); outgoing.start(outgoingSocket, StreamMessage.CURRENT_VERSION, true); }
/** * Set up incoming message handler and initiate streaming. * * This method is called once on initiator. * * @throws IOException */ @SuppressWarnings("resource") public void initiate() throws IOException { logger.debug("[Stream #{}] Sending stream init for incoming stream", session.planId()); Socket incomingSocket = session.createConnection(); incoming.start(incomingSocket, StreamMessage.CURRENT_VERSION, true); logger.debug("[Stream #{}] Sending stream init for outgoing stream", session.planId()); Socket outgoingSocket = session.createConnection(); outgoing.start(outgoingSocket, StreamMessage.CURRENT_VERSION, true); }
/** * Set up outgoing message handler on receiving side. * * @param connection Incoming connection to use for {@link OutgoingMessageHandler}. * @param version Streaming message version * @throws IOException */ public void initiateOnReceivingSide(IncomingStreamingConnection connection, boolean isForOutgoing, int version) throws IOException { if (isForOutgoing) outgoing.start(connection, version); else incoming.start(connection, version); }
/** * Set up outgoing message handler on receiving side. * * @param connection Incoming connection to use for {@link OutgoingMessageHandler}. * @param version Streaming message version * @throws IOException */ public void initiateOnReceivingSide(IncomingStreamingConnection connection, boolean isForOutgoing, int version) throws IOException { if (isForOutgoing) outgoing.start(connection, version); else incoming.start(connection, version); }
/** * Set up outgoing message handler on receiving side. * * @param connection Incoming connection to use for {@link OutgoingMessageHandler}. * @param version Streaming message version * @throws IOException */ public void initiateOnReceivingSide(IncomingStreamingConnection connection, boolean isForOutgoing, int version) throws IOException { if (isForOutgoing) outgoing.start(connection, version); else incoming.start(connection, version); }
/** * Set up outgoing message handler on receiving side. * * @param connection Incoming connection to use for {@link OutgoingMessageHandler}. * @param version Streaming message version * @throws IOException */ public void initiateOnReceivingSide(IncomingStreamingConnection connection, boolean isForOutgoing, int version) throws IOException { if (isForOutgoing) outgoing.start(connection, version); else incoming.start(connection, version); }
public ListenableFuture<?> closeIncoming() { return incoming == null ? Futures.immediateFuture(null) : incoming.close(); }
public ListenableFuture<?> closeIncoming() { return incoming == null ? Futures.immediateFuture(null) : incoming.close(); }
ConnectionHandler(StreamSession session, int incomingSocketTimeout) { this.session = session; this.incoming = new IncomingMessageHandler(session, incomingSocketTimeout); this.outgoing = new OutgoingMessageHandler(session); }
ConnectionHandler(StreamSession session) { this.session = session; this.incoming = new IncomingMessageHandler(session); this.outgoing = new OutgoingMessageHandler(session); }
public ListenableFuture<?> closeIncoming() { return incoming == null ? Futures.immediateFuture(null) : incoming.close(); }
ConnectionHandler(StreamSession session, int incomingSocketTimeout) { this.session = session; this.incoming = new IncomingMessageHandler(session, incomingSocketTimeout); this.outgoing = new OutgoingMessageHandler(session); }
ConnectionHandler(StreamSession session, int incomingSocketTimeout) { this.session = session; this.incoming = new IncomingMessageHandler(session, incomingSocketTimeout); this.outgoing = new OutgoingMessageHandler(session); }