@Override
  public void reconnect() throws MetaException {
    if (localMetaStore) {
      // For direct DB connections we don't yet support reestablishing connections.
      throw new MetaException(
          "For direct MetaStore DB connections, we don't support retries"
              + " at the client level.");
    } else {
      close();
      // Swap the first element of the metastoreUris[] with a random element from the rest
      // of the array. Rationale being that this method will generally be called when the default
      // connection has died and the default connection is likely to be the first array element.
      promoteRandomMetaStoreURI();
      open();
    }
  }
Swaps the first element of the metastoreUris array with a random element from the remainder of
the array.
amoro-format-mixed/amoro-mixed-trino/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java