DataOutputStreamAndChannel out = getWriteChannel(socket); while (!isClosed()) sendMessage(out, next); if (next.type == StreamMessage.Type.SESSION_FAILED) close(); sendMessage(out, next); signalCloseDone();
/** * 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); }
DataOutputStreamPlus out = getWriteChannel(socket); while (!isClosed()) sendMessage(out, next); if (next.type == StreamMessage.Type.SESSION_FAILED) close(); sendMessage(out, next); signalCloseDone();
DataOutputStreamPlus out = getWriteChannel(socket); while (!isClosed()) sendMessage(out, next); if (next.type == StreamMessage.Type.SESSION_FAILED) close(); sendMessage(out, next); signalCloseDone();
DataOutputStreamPlus out = getWriteChannel(socket); while (!isClosed()) sendMessage(out, next); if (next.type == StreamMessage.Type.SESSION_FAILED) close(); sendMessage(out, next); signalCloseDone();
private void sendMessage(DataOutputStreamPlus out, StreamMessage message) { try { StreamMessage.serialize(message, out, protocolVersion, session); out.flush(); message.sent(); } catch (SocketException e) { session.onError(e); close(); } catch (IOException e) { session.onError(e); } } }
private void sendMessage(DataOutputStreamPlus out, StreamMessage message) { try { StreamMessage.serialize(message, out, protocolVersion, session); out.flush(); message.sent(); } catch (SocketException e) { session.onError(e); close(); } catch (IOException e) { session.onError(e); } } }
private void sendMessage(DataOutputStreamPlus out, StreamMessage message) { try { StreamMessage.serialize(message, out, protocolVersion, session); out.flush(); message.sent(); } catch (SocketException e) { session.onError(e); close(); } catch (IOException e) { session.onError(e); } } }
private void sendMessage(DataOutputStreamAndChannel out, StreamMessage message) { try { StreamMessage.serialize(message, out, protocolVersion, session); } catch (SocketException e) { session.onError(e); close(); } catch (IOException e) { session.onError(e); } } }
/** * 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); }
public ListenableFuture<?> closeOutgoing() { return outgoing == null ? Futures.immediateFuture(null) : outgoing.close(); }
/** * 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<?> closeOutgoing() { return outgoing == null ? Futures.immediateFuture(null) : outgoing.close(); }
/** * 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); }
/** * @return true if outgoing connection is opened and ready to send messages */ public boolean isOutgoingConnected() { return outgoing != null && !outgoing.isClosed(); }