[concurrency-interest] Candidate jdk9 CompletableFuture additions

Doug Lea dl at cs.oswego.edu
Wed Jan 14 13:57:41 EST 2015


On 01/14/2015 12:36 PM, Millies, Sebastian wrote:

> I'd appreciate a method like orTimeout(defaultValue, time, unit),

Yes; thanks. To be a little more consistent with naming...

     /**
      * Completes this CompletableFuture with the given value if not
      * otherwise completed before the given timeout.
      *
      * @param value the value to use upon timeout
      * @param timeout how long to wait before completing.
      * @param unit a {@code TimeUnit} determining how to interpret the
      *        {@code timeout} parameter
      * @return this CompletableFuture
      * @since 1.9
      */
     public CompletableFuture<T> completeOnTimeout(T value, long timeout,
                                                   TimeUnit unit)

-Doug




More information about the Concurrency-interest mailing list