code: @Override
    public void reconnectFailedConnection(SearchFilter searchFilter) throws SQLException {
      proxy.lock.lock();
      try {
        if (!searchFilter.isInitialConnection()
            && (isExplicitClosed() || !isMasterHostFail())) {
          return;
        }
  
        currentConnectionAttempts.incrementAndGet();
        resetOldsBlackListHosts();
  
        List<HostAddress> loopAddress = new LinkedList<>(urlParser.getHostAddresses());
        if (HaMode.FAILOVER.equals(mode)) {
          //put the list in the following order
          // - random order not connected host
          // - random order blacklist host
          // - random order connected host
          loopAddress.removeAll(getBlacklistKeys());
          Collections.shuffle(loopAddress);
          List<HostAddress> blacklistShuffle = new LinkedList<>(getBlacklistKeys());
          blacklistShuffle.retainAll(urlParser.getHostAddresses());
          Collections.shuffle(blacklistShuffle);
          loopAddress.addAll(blacklistShuffle);
        } else {
          //order in sequence
          loopAddress.removeAll(getBlacklistKeys());
          loopAddress.addAll(getBlacklistKeys());
          loopAddress.retainAll(urlParser.getHostAddresses());
        }
  
        //put connected at end
        if (currentProtocol != null && !isMasterHostFail()) {
          loopAddress.remove(currentProtocol.getHostAddress());
          //loopAddress.add(currentProtocol.getHostAddress());
        }
  
        MasterProtocol.loop(this, globalInfo, loopAddress, searchFilter);
        //close loop if all connection are retrieved
        if (!isMasterHostFail()) {
          FailoverLoop.removeListener(this);
        }
  
        //if no error, reset failover variables
        resetMasterFailoverData();
      } finally {
        proxy.lock.unlock();
      }
    }
docs: Loop to connect failed hosts.
  
  @param searchFilter search parameters.
  @throws SQLException if there is any error during reconnection