@Override public synchronized void disconnect() { if (!eventExecutorService.isShutdown()) { // We close on the socket to get an immediate result // otherwise the producer would block until the exchange // sent a message which could be forever if (socketIO != null) { socketIO.disconnect(); } } eventExecutorService.shutdownNow(); log.debug("Stopped"); }