/** {@inheritDoc} */ @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) { if (log.isLoggable(Level.FINE)) log.fine("Session disconnected: " + ses); GridClientFutureAdapter<Boolean> handshakeFut = ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) handshakeFut.onDone( new GridClientConnectionResetException("Failed to perform handshake (connection failed).")); else { GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN); if (conn != null) conn.close(FAILED, false); } }
/** {@inheritDoc} */ @Override public void onMessage(GridNioSession ses, Object msg) { GridClientFutureAdapter<Boolean> handshakeFut = ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) { assert msg instanceof GridClientHandshakeResponse; handleHandshakeResponse(handshakeFut, (GridClientHandshakeResponse)msg); } else { GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN); assert conn != null; if (msg instanceof GridClientPingPacket) conn.handlePingResponse(); else { try { conn.handleResponse((GridClientMessage)msg); } catch (IOException e) { log.log(Level.SEVERE, "Failed to parse response.", e); } } } }
/** {@inheritDoc} */ @Override public void onSessionClosed(GridNioSession ses) throws IgniteCheckedException { GridNioSslHandler hnd = sslHandler(ses); try { GridNioFutureImpl<?> fut = ses.removeMeta(HANDSHAKE_FUT_META_KEY); if (fut != null) fut.onDone(new IgniteCheckedException("SSL handshake failed (connection closed).")); hnd.shutdown(); } finally { proceedSessionClosed(ses); } }
ses.addMeta(READER_META_KEY, reader = readerFactory.reader(ses, msgFactory)); Message msg = ses.removeMeta(MSG_META_KEY);
ParserState state = ses.removeMeta(PARSER_STATE.ordinal());
ses.removeMeta(MAGIC_BUF_KEY); ses.addMeta(MAGIC_META_KEY, U.IGNITE_HEADER.length);
initHandshakeComplete = true; GridNioFutureImpl<?> fut = ses.removeMeta(HANDSHAKE_FUT_META_KEY);
IgniteInternalFuture<GridRestResponse> lastFut = ses.removeMeta(LAST_FUT.ordinal());
/** {@inheritDoc} */ @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) { if (log.isLoggable(Level.FINE)) log.fine("Session disconnected: " + ses); GridClientFutureAdapter<Boolean> handshakeFut = ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) handshakeFut.onDone( new GridClientConnectionResetException("Failed to perform handshake (connection failed).")); else { GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN); if (conn != null) conn.close(FAILED, false); } }
/** {@inheritDoc} */ @Override public void onMessage(GridNioSession ses, Object msg) { GridClientFutureAdapter<Boolean> handshakeFut = ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) { assert msg instanceof GridClientHandshakeResponse; handleHandshakeResponse(handshakeFut, (GridClientHandshakeResponse)msg); } else { GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN); assert conn != null; if (msg instanceof GridClientPingPacket) conn.handlePingResponse(); else { try { conn.handleResponse((GridClientMessage)msg); } catch (IOException e) { log.log(Level.SEVERE, "Failed to parse response.", e); } } } }
ses.addMeta(READER_META_KEY, reader = readerFactory.reader(ses, msgFactory)); Message msg = ses.removeMeta(MSG_META_KEY);
/** {@inheritDoc} */ @Override public void onSessionClosed(GridNioSession ses) throws IgniteCheckedException { GridNioSslHandler hnd = sslHandler(ses); try { GridNioFutureImpl<?> fut = ses.removeMeta(HANDSHAKE_FUT_META_KEY); if (fut != null) fut.onDone(new IgniteCheckedException("SSL handshake failed (connection closed).")); hnd.shutdown(); } finally { proceedSessionClosed(ses); } }
ParserState state = ses.removeMeta(PARSER_STATE.ordinal());
ses.removeMeta(MAGIC_BUF_KEY); ses.addMeta(MAGIC_META_KEY, U.IGNITE_HEADER.length);
initHandshakeComplete = true; GridNioFutureImpl<?> fut = ses.removeMeta(HANDSHAKE_FUT_META_KEY);
IgniteInternalFuture<GridRestResponse> lastFut = ses.removeMeta(LAST_FUT.ordinal());