All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databricks.sdk.support.Wait Maven / Gradle / Ivy

package com.databricks.sdk.support;

import java.time.Duration;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;

public class Wait {
  private final WaitStarter impl;
  private final R response;
  private Consumer progress;

  public Wait(WaitStarter impl) {
    this(impl, null);
  }

  public Wait(WaitStarter impl, R response) {
    this.impl = impl;
    this.response = response;
  }

  public Wait onProgress(Consumer progress) {
    this.progress = progress;
    return this;
  }

  public T get() throws TimeoutException {
    return get(Duration.ofMinutes(20));
  }

  public T get(Duration timeout) throws TimeoutException {
    return impl.apply(timeout, progress);
  }

  public R getResponse() {
    return response;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy