public static T loop()

in report-builder/src/jetbrains/coverage/report/impl/IOUtil.java [77:99]


  public static <T, E extends Exception> T loop(Callable<T> action, boolean onlyWithIoCause) throws E {
    int attempt = 0;
    while (true) {
      try {
        attempt++;
        return action.call();
      } catch (Exception e) {
        if (onlyWithIoCause && !(e.getCause() instanceof IOException)) {
          throw (E) e;
        }

        if (attempt < repeatMaxCount) {
          try {
            Thread.sleep(repeatCooldownMs);
          } catch (InterruptedException ex) {
            // no-op
          }
        } else {
          throw (E) e;
        }
      }
    }
  }