private <R> RetryWithClearSessionDataResult<R> retryWithClearSessionData(@NotNull RepositorySystemSession sessionTemplate,
                                                                             @NotNull ThrowingFunction<RepositorySystemSession, ? extends R> func)
      throws Exception {
      // Some errors are cached in session data, and for proper retries work, we must
      // reset this data with RepositorySystemSession#setData after failure.
      return myRetry.retry(() -> {
        RepositorySystemSession newSession = cloneSessionAndClearData(sessionTemplate);
        R result = func.get(newSession);
        return new RetryWithClearSessionDataResult<>(newSession, result);
      }, LOG);
    }
private <R> RetryWithClearSessionDataResult<R> retryWithClearSessionData(@NotNull RepositorySystemSession sessionTemplate,
                                                                             @NotNull ThrowingFunction<RepositorySystemSession, ? extends R> func)