code: private static <T extends EntityResponse> T waitFor(InvokeFuture<T> future)
        throws EntityException {
      boolean interrupted = Thread.interrupted();
      try {
        while (true) {
          try {
            return future.get();
          } catch (InterruptedException e) {
            interrupted = true;
          }
        }
      } finally {
        if (interrupted) {
          Thread.currentThread().interrupt();
        }
      }
    }
docs: Will wait forever on {@code Future.get()}. In case of interruption, it will take note and resume waiting on get. The
  interruption flag is then set if needed before returning the get value (or if an exception occurred).
  
  @param future Future we want to get
  @param <T> type of the response
  @return the result of the get
  @throws EntityException exception that might be thrown by the future in case of error