/** * @param ignite Node. * @throws Exception If failed. * @return {@code True} if closed at least one session. */ static boolean closeSessions(Ignite ignite) throws Exception { TcpCommunicationSpi commSpi = (TcpCommunicationSpi)ignite.configuration().getCommunicationSpi(); Map<UUID, GridCommunicationClient[]> clients = U.field(commSpi, "clients"); boolean closed = false; for (GridCommunicationClient[] clients0 : clients.values()) { for (GridCommunicationClient client : clients0) { if (client != null) { GridTcpNioCommunicationClient client0 = (GridTcpNioCommunicationClient)client; GridNioSession ses = client0.session(); ses.close(); closed = true; } } } return closed; } }
/** {@inheritDoc} */ @Override public void sendMessage(ByteBuffer data) throws IgniteCheckedException { if (closed()) throw new IgniteCheckedException("Client was closed: " + this); GridNioFuture<?> fut = ses.send(data); if (fut.isDone()) fut.get(); }
client = new GridTcpNioCommunicationClient(connIdx, ses, log);
lsnr.onDisconnected(((GridTcpNioCommunicationClient)commClient).session(), new IOException("Test exception"));
/** {@inheritDoc} */ @Override public void sendMessage(ByteBuffer data) throws IgniteCheckedException { if (closed()) throw new IgniteCheckedException("Client was closed: " + this); GridNioFuture<?> fut = ses.send(data); if (fut.isDone()) fut.get(); }
nioSrvr.sendSystem(((GridTcpNioCommunicationClient)client).session(), msg);
GridTcpNioCommunicationClient tcpClient = ((GridTcpNioCommunicationClient)client0); if (tcpClient.session().closeTime() > 0 && removeNodeClient(nodeId, client0)) { if (log.isDebugEnabled()) log.debug("Session was closed after client creation, will retry " +
nioSrvr.sendSystem(((GridTcpNioCommunicationClient)client).session(), msg);
GridTcpNioCommunicationClient tcpClient = ((GridTcpNioCommunicationClient)client0); if (tcpClient.session().closeTime() > 0 && removeNodeClient(nodeId, client0)) { if (log.isDebugEnabled()) log.debug("Session was closed after client creation, will retry " +