Skip to content

Polling & Timeout-related functionality

Compare
Choose a tag to compare
@vsilaev vsilaev released this 28 Nov 11:51
· 299 commits to master since this release

Features

Promise interface is extended with timeout-related methods

  • Promise.onTimeout(delay, [cancelOnTimeout=true])
  • Promise.orTimeout(defaultValue, delay, [cancelOnTimeout=true)
  • Promise.delay(delay, [delayOnError=true])
    Additionally, there is a method to specify initial delay
  • CompletableTask.delay(delay, executor)

Re-tryable polling support

Promises now extended with several methods that allows polling Runnable / Callable according to RetryPolicy until result is available:

  • Promises.poll(runnable, executor, retryPolicy)
  • Promises.poll(callable, executor, retryPolicy)
  • Promises.pollOptional(callableWithOptionalResult executor, retryPolicy)

Easing creation of DependentPromise

Promise now have a dependent() method that converts this Promise to a DependentPromise to allow writing of fluent API chains.

Promises combinators methods now have additional overloads

Promises.all / any / atLeast and corresponding *Strict now overloaded to accept a list of Promise-es in addition to vararg array.

Bug fixes

None