/** * Closes the session by timeout (i.e. inactivity within the configured period of time). * * @param ses Session, that was inactive. */ @Override public void onSessionIdleTimeout(GridNioSession ses) { ses.close(); } }
/** {@inheritDoc} */ @Override public void onSessionIdleTimeout(GridNioSession ses) { ses.close(); }
/** {@inheritDoc} */ @Override public void onSessionWriteTimeout(GridNioSession ses) { if (log.isLoggable(Level.FINE)) log.fine("Closing NIO session because of write timeout."); ses.close(); }
/** {@inheritDoc} */ @Override public void onSessionIdleTimeout(GridNioSession ses) { if (log.isLoggable(Level.FINE)) log.fine("Closing NIO session because of idle timeout."); ses.close(); } }
/** {@inheritDoc} */ @Override public void onSessionIdleTimeout(GridNioSession ses) { U.warn(log, "Closing NIO session because of idle."); ses.close(); }
/** {@inheritDoc} */ @Override public void onSessionWriteTimeout(GridNioSession ses) { U.warn(log, "Closing NIO session because of write timeout."); ses.close(); }
/** {@inheritDoc} */ @Override public boolean close() { boolean res = super.close(); if (res) ses.close(); return res; }
/** {@inheritDoc} */ @Override public void forceClose() { super.forceClose(); ses.close(); }
/** {@inheritDoc} */ @Override public void onSessionIdleTimeout(GridNioSession ses) { ses.close(); } }
/** {@inheritDoc} */ @Override public void forceClose() { super.forceClose(); ses.close(); }
/** {@inheritDoc} */ @Override public boolean close() { boolean res = super.close(); if (res) ses.close(); return res; }
/** {@inheritDoc} */ @Override public void onSessionWriteTimeout(GridNioSession ses) { ses.close(); }
@Override public void onSessionIdleTimeout(GridNioSession ses) { info("Session idle: " + ses); latch.countDown(); ses.close(); } };
@Override public void onSessionWriteTimeout(GridNioSession ses) { info("Session write timed out: " + ses); latch.countDown(); ses.close(); }
/** {@inheritDoc} */ @Override public void onConnected(GridNioSession ses) { lastSes = ses; connCnt.incrementAndGet(); if (failOnConnect) ses.close(); else succConnCnt.incrementAndGet(); }
@Override public void apply(IgniteInternalFuture<?> fut) { try { // Make sure there were no errors. fut.get(); } catch (IgniteCheckedException e) { log.warning("Failed to send handshake message, will close session: " + ses, e); ses.close(); } } });
/** * Closes all opened connections. */ public void fail() { assert lastSes != null; lastSes.close(); failOnConnect = true; resetCounters(); }
/** {@inheritDoc} */ @Override public boolean sendMessage(@Nullable UUID nodeId, Message msg, IgniteInClosure<IgniteException> c) throws IgniteCheckedException { try { // Node ID is never provided in asynchronous send mode. assert nodeId == null; ses.sendNoFuture(msg, c); } catch (IgniteCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed to send message [client=" + this + ", err=" + e + ']'); if (e.getCause() instanceof IOException) { ses.close(); return true; } else throw new IgniteCheckedException("Failed to send message [client=" + this + ']', e); } return false; }
/** {@inheritDoc} */ @Override public void onMessage(final GridNioSession ses, final GridRedisMessage msg) { if (handlers.get(msg.command()) == null) { U.warn(log, "Cannot find the corresponding command (session will be closed) [ses=" + ses + ", command=" + msg.command().name() + ']'); ses.close(); return; } else { String cacheName = ses.meta(CONN_CTX_META_KEY); if (cacheName != null) msg.cacheName(cacheName); IgniteInternalFuture<GridRedisMessage> f = handlers.get(msg.command()).handleAsync(ses, msg); f.listen(new CIX1<IgniteInternalFuture<GridRedisMessage>>() { @Override public void applyx(IgniteInternalFuture<GridRedisMessage> f) throws IgniteCheckedException { GridRedisMessage res = f.get(); sendResponse(ses, res); } }); } }
/** * @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; } }