Interface SynchronizerApi.Base.SleepInvoke

    • Method Detail

      • thenSleepUntil

        default Object thenSleepUntil​(BooleanSupplier state)
        Adds sleeping to the action chain.

        When performing this action, the chain will ensure the given condition is met before returning. If the supplier returns false, this action chain sleeps until another chain wakes it up. Then, the supplier is called again and if it still returns false, the chain resumes sleeping. Otherwise, the chain invocation finishes.
        Parameters:
        state - the supplier that returns true if the action chain should finish, false otherwise.
        Throws:
        NullPointerException - if state is null
      • thenSleepUntil

        Object thenSleepUntil​(BooleanSupplier state,
                              Duration timeout)
        Adds sleeping to the action chain.

        When performing this action, the chain will ensure the given condition is met before returning. If the supplier returns false, this action chain sleeps until either another chain wakes it up or the timeout has passed. Then, the supplier is called again and if it still returns false, the chain resumes sleeping. Otherwise, the chain invocation finishes.
        Parameters:
        state - the supplier that returns true if the action chain should finish, false otherwise.
        timeout - the maximum amount of time to sleep before re-checking the condition, or null to sleep indefinitely.
        Throws:
        NullPointerException - if state is null