private void ensureCurrentBatch() {
      if (currentIter != null && currentIter.hasNext()) {
        return;
      }
      currentIter = null;
      Map<K, V> currentBatch;
      do {
        try {
          currentBatch = fetchNextBatch();
        } catch (TException ex) {
          throw new RuntimeException(ex);
        }
        if (currentBatch == null) {
          return; // No more data.
        }
      } while (currentBatch.isEmpty());
      currentIter = currentBatch.entrySet().iterator();
    }
Creates a synchronized wrapper for any {@link IMetaStoreClient}. This may be used by
multi-threaded applications until we have fixed all reentrancy bugs.

@param client unsynchronized client
@return synchronized client
amoro-format-mixed/amoro-mixed-trino/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java