code: protected void clearMessageQueue() {
      MessageTuple tuple = null;
      while ((tuple = messageQueue.poll()) != null) {
        Message msg = tuple.getMessage();
        if (msg.getType() == MessageType.DISCONNECTED) {
          this.transport.clear(msg.getDisconnected().getServerId());
        } else if (msg.getType() == MessageType.SHUT_DOWN) {
          throw new LeftCluster("Shutdown Zab.");
        }
      }
    }
docs: Clears all the messages in the message queue, clears the peer in transport
  if it's the DISCONNECTED message. This function should be called only
  right before going back to recovery.