Skip to content

Instantly share code, notes, and snippets.

@pmiddend
Created October 21, 2016 07:00
Show Gist options
  • Save pmiddend/81223babefae3e25cd6ace8610383fcc to your computer and use it in GitHub Desktop.
Save pmiddend/81223babefae3e25cd6ace8610383fcc to your computer and use it in GitHub Desktop.
public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) {
if (unit == null)
throw new NullPointerException();
if (result == null)
whenComplete(new Canceller(Delayer.delay(new Timeout(this),
timeout, unit)));
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment