public static boolean isServerPortBindCollision()

in common/src/main/java/org/apache/uniffle/common/util/RssUtils.java [213:232]


  public static boolean isServerPortBindCollision(Throwable e) {
    if (e instanceof BindException) {
      if (e.getMessage() != null) {
        return true;
      }
      return isServerPortBindCollision(e.getCause());
    } else if (e instanceof MultiException) {
      return !((MultiException) e)
          .getThrowables().stream()
              .noneMatch((Throwable throwable) -> isServerPortBindCollision(throwable));
    } else if (e instanceof Errors.NativeIoException) {
      return (e.getMessage() != null && e.getMessage().startsWith("bind() failed: "))
          || isServerPortBindCollision(e.getCause());
    } else if (e instanceof IOException) {
      return (e.getMessage() != null && e.getMessage().startsWith("Failed to bind to address"))
          || isServerPortBindCollision(e.getCause());
    } else {
      return false;
    }
  }