public synchronized void freeze(final CoreRemotingConnection connectionToKeepOpen) { if (!started) return; failureCheckAndFlushThread.close(false); for (Acceptor acceptor : acceptors) { try { acceptor.pause(); } catch (Exception e) { HornetQServerLogger.LOGGER.errorStoppingAcceptor(); } } HashMap<Object, ConnectionEntry> connectionEntries = new HashMap<Object, ConnectionEntry>(connections); // Now we ensure that no connections will process any more packets after this method is // complete then send a disconnect packet for (Entry<Object, ConnectionEntry> entry : connectionEntries.entrySet()) { RemotingConnection conn = entry.getValue().connection; if (conn.equals(connectionToKeepOpen)) continue; if (HornetQServerLogger.LOGGER.isTraceEnabled()) { HornetQServerLogger.LOGGER.trace("Sending connection.disconnection packet to " + conn); } if (!conn.isClient()) { conn.disconnect(false); connections.remove(entry.getKey()); } } }