code: public void foundActiveSecondary(Protocol newSecondaryProtocol) throws SQLException {
      if (isSecondaryHostFail()) {
        if (isExplicitClosed()) {
          newSecondaryProtocol.close();
          return;
        }
  
        if (proxy.lock.tryLock()) {
          try {
            lockAndSwitchSecondary(newSecondaryProtocol);
          } finally {
            proxy.lock.unlock();
          }
        } else {
          if (!waitNewSecondaryProtocol.compareAndSet(null, newSecondaryProtocol)) {
            newSecondaryProtocol.close();
          }
        }
      } else {
        newSecondaryProtocol.close();
      }
    }
docs: Method called when a new secondary connection is found after a fallback.
  
  @param newSecondaryProtocol the new active connection
  @throws SQLException if switch failed