@Override
  public <R> R run(Action<R, C, E> action, boolean retry) throws E, InterruptedException {
    C client = get();
    try {
      return action.run(client);

    } catch (Exception exc) {
      if (retry && isConnectionException(exc)) {
        try {
          client = reconnect(client);
        } catch (Exception ignored) {
          // if reconnection throws any exception, rethrow the original failure
          throw reconnectExc.cast(exc);
        }

        return action.run(client);
      }

      throw exc;

    } finally {
      release(client);
    }
  }
Copied from iceberg-common

@param <C> client type
@param <E> exception type that client will throw
amoro-common/src/main/java/org/apache/amoro/client/ClientPoolImpl.java