Class Waiter

java.lang.Object
dev.comfast.util.waiter.Waiter

public class Waiter extends Object
  • Constructor Details

    • Waiter

      public Waiter(long timeoutMs)
    • Waiter

      public Waiter(WaiterConfig conf)
  • Method Details

    • waitFor

      public void waitFor(Runnable action)
      Repeat the action till it ends without exception.
      Throws:
      WaitTimeout - with detailed information about Exceptions happen
    • waitFor

      public <T> T waitFor(Supplier<T> action)
      Repeat the action till it ends without exception.
      Returns:
      action result
      Throws:
      WaitTimeout - with detailed information about Exceptions happen
    • waitForValue

      public <T> T waitForValue(Supplier<T> action)
      Repeat the action till it returns truthy value.

      Ignores any Exception during subsequent tries.

      Throws:
      WaitTimeout - with detailed information about Exceptions happen