/** * @return true if the cnxn that contains the sessionId exists in this ServerCnxnFactory * and it's closed. Otherwise false. */ public boolean closeSession(long sessionId) { ServerCnxn cnxn = sessionMap.remove(sessionId); if (cnxn != null) { try { cnxn.close(); } catch (Exception e) { LOG.warn("exception during session close", e); } return true; } return false; }
/** * clean up the socket related to a command and also make sure we flush the * data before we do that * * @param pwriter * the pwriter for a command socket */ public void cleanupWriterSocket(PrintWriter pwriter) { try { if (pwriter != null) { pwriter.flush(); pwriter.close(); } } catch (Exception e) { LOG.info("Error closing PrintWriter ", e); } finally { try { close(); } catch (Exception e) { LOG.error("Error closing a command socket ", e); } } } }
/** * clear all the connections in the selector * */ @Override @SuppressWarnings("unchecked") public void closeAll() { // clear all the connections on which we are selecting for (ServerCnxn cnxn : cnxns) { try { // This will remove the cnxn from cnxns cnxn.close(); } catch (Exception e) { LOG.warn("Ignoring exception closing cnxn sessionid 0x" + Long.toHexString(cnxn.getSessionId()), e); } } }
@Override public void closeAll() { if (LOG.isDebugEnabled()) { LOG.debug("closeAll()"); } // clear all the connections on which we are selecting int length = cnxns.size(); for (ServerCnxn cnxn : cnxns) { try { // This will remove the cnxn from cnxns cnxn.close(); } catch (Exception e) { LOG.warn("Ignoring exception closing cnxn sessionid 0x" + Long.toHexString(cnxn.getSessionId()), e); } } if (LOG.isDebugEnabled()) { LOG.debug("allChannels size:" + allChannels.size() + " cnxns size:" + length); } }
} else { LOG.warn("Closing client connection due to SASL authentication failure."); cnxn.close();
cnxn.close();
} else { LOG.warn("Closing client connection due to SASL authentication failure."); cnxn.close();
Iterable<ServerCnxn> connections = serverFactory.getConnections(); for (ServerCnxn serverCnxn : connections) { serverCnxn.close(); try { serverCnxn.toString();