jdk/src/java.base/share/classes/java/util/concurrent/CompletionStage.java
author dl
Wed, 21 Dec 2016 14:26:52 -0800
changeset 42927 1d31e540bfcb
parent 42322 c3474fef4fe4
permissions -rw-r--r--
8170484: Miscellaneous changes imported from jsr166 CVS 2016-12 Reviewed-by: martin, smarks, psandoz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     1
/*
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     3
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
     9
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    14
 * accompanied this code).
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    15
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    19
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    22
 * questions.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    23
 */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    24
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    25
/*
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    26
 * This file is available under and governed by the GNU General Public
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    27
 * License version 2 only, as published by the Free Software Foundation.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    28
 * However, the following notice accompanied the original version of this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    29
 * file:
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    30
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    31
 * Written by Doug Lea with assistance from members of JCP JSR-166
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    32
 * Expert Group and released to the public domain, as explained at
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    33
 * http://creativecommons.org/publicdomain/zero/1.0/
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    34
 */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    35
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    36
package java.util.concurrent;
32987
e5e5ab01398e 8134851: Integrate CompletableFuture with API enhancements
dl
parents: 26336
diff changeset
    37
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    38
import java.util.function.BiConsumer;
32987
e5e5ab01398e 8134851: Integrate CompletableFuture with API enhancements
dl
parents: 26336
diff changeset
    39
import java.util.function.BiFunction;
e5e5ab01398e 8134851: Integrate CompletableFuture with API enhancements
dl
parents: 26336
diff changeset
    40
import java.util.function.Consumer;
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    41
import java.util.function.Function;
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    42
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    43
/**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    44
 * A stage of a possibly asynchronous computation, that performs an
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    45
 * action or computes a value when another CompletionStage completes.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    46
 * A stage completes upon termination of its computation, but this may
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    47
 * in turn trigger other dependent stages.  The functionality defined
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    48
 * in this interface takes only a few basic forms, which expand out to
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    49
 * a larger set of methods to capture a range of usage styles:
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    50
 *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    51
 * <ul>
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    52
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    53
 * <li>The computation performed by a stage may be expressed as a
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    54
 * Function, Consumer, or Runnable (using methods with names including
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    55
 * <em>apply</em>, <em>accept</em>, or <em>run</em>, respectively)
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    56
 * depending on whether it requires arguments and/or produces results.
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    57
 * For example:
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    58
 * <pre> {@code
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    59
 * stage.thenApply(x -> square(x))
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    60
 *      .thenAccept(x -> System.out.print(x))
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    61
 *      .thenRun(() -> System.out.println());}</pre>
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    62
 *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    63
 * An additional form (<em>compose</em>) allows the construction of
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    64
 * computation pipelines from functions returning completion stages.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    65
 *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    66
 * <p>Any argument to a stage's computation is the outcome of a
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    67
 * triggering stage's computation.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    68
 *
32987
e5e5ab01398e 8134851: Integrate CompletableFuture with API enhancements
dl
parents: 26336
diff changeset
    69
 * <li>One stage's execution may be triggered by completion of a
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    70
 * single stage, or both of two stages, or either of two stages.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    71
 * Dependencies on a single stage are arranged using methods with
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    72
 * prefix <em>then</em>. Those triggered by completion of
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    73
 * <em>both</em> of two stages may <em>combine</em> their results or
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    74
 * effects, using correspondingly named methods. Those triggered by
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    75
 * <em>either</em> of two stages make no guarantees about which of the
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    76
 * results or effects are used for the dependent stage's computation.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    77
 *
32987
e5e5ab01398e 8134851: Integrate CompletableFuture with API enhancements
dl
parents: 26336
diff changeset
    78
 * <li>Dependencies among stages control the triggering of
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    79
 * computations, but do not otherwise guarantee any particular
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    80
 * ordering. Additionally, execution of a new stage's computations may
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    81
 * be arranged in any of three ways: default execution, default
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    82
 * asynchronous execution (using methods with suffix <em>async</em>
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    83
 * that employ the stage's default asynchronous execution facility),
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    84
 * or custom (via a supplied {@link Executor}).  The execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    85
 * properties of default and async modes are specified by
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    86
 * CompletionStage implementations, not this interface. Methods with
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    87
 * explicit Executor arguments may have arbitrary execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    88
 * properties, and might not even support concurrent execution, but
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    89
 * are arranged for processing in a way that accommodates asynchrony.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
    90
 *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    91
 * <li>Two method forms ({@link #handle handle} and {@link
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    92
 * #whenComplete whenComplete}) support unconditional computation
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    93
 * whether the triggering stage completed normally or exceptionally.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    94
 * Method {@link #exceptionally exceptionally} supports computation
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    95
 * only when the triggering stage completes exceptionally, computing a
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    96
 * replacement result, similarly to the java {@code catch} keyword.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    97
 * In all other cases, if a stage's computation terminates abruptly
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    98
 * with an (unchecked) exception or error, then all dependent stages
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
    99
 * requiring its completion complete exceptionally as well, with a
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   100
 * {@link CompletionException} holding the exception as its cause.  If
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   101
 * a stage is dependent on <em>both</em> of two stages, and both
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   102
 * complete exceptionally, then the CompletionException may correspond
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   103
 * to either one of these exceptions.  If a stage is dependent on
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   104
 * <em>either</em> of two others, and only one of them completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   105
 * exceptionally, no guarantees are made about whether the dependent
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   106
 * stage completes normally or exceptionally. In the case of method
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   107
 * {@code whenComplete}, when the supplied action itself encounters an
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   108
 * exception, then the stage completes exceptionally with this
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   109
 * exception unless the source stage also completed exceptionally, in
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   110
 * which case the exceptional completion from the source stage is
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   111
 * given preference and propagated to the dependent stage.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   112
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   113
 * </ul>
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   114
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   115
 * <p>All methods adhere to the above triggering, execution, and
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   116
 * exceptional completion specifications (which are not repeated in
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   117
 * individual method specifications). Additionally, while arguments
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   118
 * used to pass a completion result (that is, for parameters of type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   119
 * {@code T}) for methods accepting them may be null, passing a null
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   120
 * value for any other parameter will result in a {@link
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   121
 * NullPointerException} being thrown.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   122
 *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   123
 * <p>Method form {@link #handle handle} is the most general way of
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   124
 * creating a continuation stage, unconditionally performing a
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   125
 * computation that is given both the result and exception (if any) of
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   126
 * the triggering CompletionStage, and computing an arbitrary result.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   127
 * Method {@link #whenComplete whenComplete} is similar, but preserves
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   128
 * the result of the triggering stage instead of computing a new one.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   129
 * Because a stage's normal result may be {@code null}, both methods
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   130
 * should have a computation structured thus:
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   131
 *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   132
 * <pre>{@code (result, exception) -> {
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   133
 *   if (exception == null) {
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   134
 *     // triggering stage completed normally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   135
 *   } else {
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   136
 *     // triggering stage completed exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   137
 *   }
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   138
 * }}</pre>
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   139
 *
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   140
 * <p>This interface does not define methods for initially creating,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   141
 * forcibly completing normally or exceptionally, probing completion
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   142
 * status or results, or awaiting completion of a stage.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   143
 * Implementations of CompletionStage may provide means of achieving
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   144
 * such effects, as appropriate.  Method {@link #toCompletableFuture}
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   145
 * enables interoperability among different implementations of this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   146
 * interface by providing a common conversion type.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   147
 *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   148
 * @author Doug Lea
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   149
 * @since 1.8
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   150
 */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   151
public interface CompletionStage<T> {
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   152
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   153
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   154
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   155
     * normally, is executed with this stage's result as the argument
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   156
     * to the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   157
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   158
     * <p>This method is analogous to
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   159
     * {@link java.util.Optional#map Optional.map} and
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   160
     * {@link java.util.stream.Stream#map Stream.map}.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   161
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   162
     * <p>See the {@link CompletionStage} documentation for rules
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   163
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   164
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   165
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   166
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   167
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   168
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   169
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   170
    public <U> CompletionStage<U> thenApply(Function<? super T,? extends U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   171
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   172
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   173
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   174
     * normally, is executed using this stage's default asynchronous
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   175
     * execution facility, with this stage's result as the argument to
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   176
     * the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   177
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   178
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   179
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   180
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   181
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   182
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   183
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   184
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   185
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   186
    public <U> CompletionStage<U> thenApplyAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   187
        (Function<? super T,? extends U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   188
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   189
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   190
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   191
     * normally, is executed using the supplied Executor, with this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   192
     * stage's result as the argument to the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   193
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   194
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   195
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   196
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   197
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   198
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   199
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   200
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   201
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   202
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   203
    public <U> CompletionStage<U> thenApplyAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   204
        (Function<? super T,? extends U> fn,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   205
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   206
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   207
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   208
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   209
     * normally, is executed with this stage's result as the argument
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   210
     * to the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   211
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   212
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   213
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   214
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   215
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   216
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   217
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   218
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   219
    public CompletionStage<Void> thenAccept(Consumer<? super T> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   220
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   221
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   222
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   223
     * normally, is executed using this stage's default asynchronous
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   224
     * execution facility, with this stage's result as the argument to
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   225
     * the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   226
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   227
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   228
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   229
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   230
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   231
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   232
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   233
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   234
    public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   235
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   236
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   237
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   238
     * normally, is executed using the supplied Executor, with this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   239
     * stage's result as the argument to the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   240
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   241
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   242
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   243
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   244
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   245
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   246
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   247
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   248
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   249
    public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   250
                                                 Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   251
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   252
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   253
     * normally, executes the given action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   254
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   255
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   256
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   257
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   258
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   259
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   260
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   261
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   262
    public CompletionStage<Void> thenRun(Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   263
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   264
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   265
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   266
     * normally, executes the given action using this stage's default
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   267
     * asynchronous execution facility.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   268
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   269
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   270
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   271
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   272
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   273
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   274
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   275
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   276
    public CompletionStage<Void> thenRunAsync(Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   277
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   278
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   279
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   280
     * normally, executes the given action using the supplied Executor.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   281
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   282
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   283
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   284
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   285
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   286
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   287
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   288
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   289
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   290
    public CompletionStage<Void> thenRunAsync(Runnable action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   291
                                              Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   292
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   293
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   294
     * Returns a new CompletionStage that, when this and the other
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   295
     * given stage both complete normally, is executed with the two
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   296
     * results as arguments to the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   297
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   298
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   299
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   300
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   301
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   302
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   303
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   304
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   305
     * @param <V> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   306
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   307
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   308
    public <U,V> CompletionStage<V> thenCombine
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   309
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   310
         BiFunction<? super T,? super U,? extends V> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   311
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   312
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   313
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   314
     * given stage both complete normally, is executed using this
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   315
     * stage's default asynchronous execution facility, with the two
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   316
     * results as arguments to the supplied function.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   317
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   318
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   319
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   320
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   321
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   322
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   323
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   324
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   325
     * @param <V> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   326
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   327
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   328
    public <U,V> CompletionStage<V> thenCombineAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   329
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   330
         BiFunction<? super T,? super U,? extends V> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   331
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   332
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   333
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   334
     * given stage both complete normally, is executed using the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   335
     * supplied executor, with the two results as arguments to the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   336
     * supplied function.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   337
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   338
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   339
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   340
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   341
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   342
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   343
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   344
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   345
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   346
     * @param <V> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   347
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   348
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   349
    public <U,V> CompletionStage<V> thenCombineAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   350
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   351
         BiFunction<? super T,? super U,? extends V> fn,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   352
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   353
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   354
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   355
     * Returns a new CompletionStage that, when this and the other
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   356
     * given stage both complete normally, is executed with the two
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   357
     * results as arguments to the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   358
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   359
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   360
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   361
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   362
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   363
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   364
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   365
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   366
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   367
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   368
    public <U> CompletionStage<Void> thenAcceptBoth
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   369
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   370
         BiConsumer<? super T, ? super U> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   371
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   372
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   373
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   374
     * given stage both complete normally, is executed using this
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   375
     * stage's default asynchronous execution facility, with the two
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   376
     * results as arguments to the supplied action.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   377
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   378
     * See the {@link CompletionStage} documentation for rules
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   379
     * covering exceptional completion.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   380
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   381
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   382
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   383
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   384
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   385
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   386
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   387
    public <U> CompletionStage<Void> thenAcceptBothAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   388
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   389
         BiConsumer<? super T, ? super U> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   390
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   391
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   392
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   393
     * given stage both complete normally, is executed using the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   394
     * supplied executor, with the two results as arguments to the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   395
     * supplied action.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   396
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   397
     * See the {@link CompletionStage} documentation for rules
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   398
     * covering exceptional completion.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   399
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   400
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   401
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   402
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   403
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   404
     * @param <U> the type of the other CompletionStage's result
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   405
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   406
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   407
    public <U> CompletionStage<Void> thenAcceptBothAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   408
        (CompletionStage<? extends U> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   409
         BiConsumer<? super T, ? super U> action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   410
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   411
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   412
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   413
     * Returns a new CompletionStage that, when this and the other
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   414
     * given stage both complete normally, executes the given action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   415
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   416
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   417
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   418
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   419
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   420
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   421
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   422
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   423
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   424
    public CompletionStage<Void> runAfterBoth(CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   425
                                              Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   426
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   427
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   428
     * given stage both complete normally, executes the given action
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   429
     * using this stage's default asynchronous execution facility.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   430
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   431
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   432
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   433
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   434
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   435
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   436
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   437
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   438
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   439
    public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   440
                                                   Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   441
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   442
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   443
     * Returns a new CompletionStage that, when this and the other
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   444
     * given stage both complete normally, executes the given action
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   445
     * using the supplied executor.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   446
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   447
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   448
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   449
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   450
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   451
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   452
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   453
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   454
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   455
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   456
    public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   457
                                                   Runnable action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   458
                                                   Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   459
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   460
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   461
     * other given stage complete normally, is executed with the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   462
     * corresponding result as argument to the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   463
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   464
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   465
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   466
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   467
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   468
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   469
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   470
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   471
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   472
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   473
    public <U> CompletionStage<U> applyToEither
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   474
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   475
         Function<? super T, U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   476
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   477
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   478
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   479
     * other given stage complete normally, is executed using this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   480
     * stage's default asynchronous execution facility, with the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   481
     * corresponding result as argument to the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   482
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   483
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   484
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   485
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   486
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   487
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   488
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   489
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   490
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   491
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   492
    public <U> CompletionStage<U> applyToEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   493
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   494
         Function<? super T, U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   495
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   496
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   497
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   498
     * other given stage complete normally, is executed using the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   499
     * supplied executor, with the corresponding result as argument to
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   500
     * the supplied function.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   501
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   502
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   503
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   504
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   505
     * @param other the other CompletionStage
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   506
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   507
     * returned CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   508
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   509
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   510
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   511
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   512
    public <U> CompletionStage<U> applyToEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   513
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   514
         Function<? super T, U> fn,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   515
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   516
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   517
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   518
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   519
     * other given stage complete normally, is executed with the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   520
     * corresponding result as argument to the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   521
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   522
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   523
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   524
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   525
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   526
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   527
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   528
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   529
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   530
    public CompletionStage<Void> acceptEither
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   531
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   532
         Consumer<? super T> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   533
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   534
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   535
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   536
     * other given stage complete normally, is executed using this
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   537
     * stage's default asynchronous execution facility, with the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   538
     * corresponding result as argument to the supplied action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   539
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   540
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   541
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   542
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   543
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   544
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   545
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   546
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   547
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   548
    public CompletionStage<Void> acceptEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   549
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   550
         Consumer<? super T> action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   551
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   552
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   553
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   554
     * other given stage complete normally, is executed using the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   555
     * supplied executor, with the corresponding result as argument to
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   556
     * the supplied action.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   557
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   558
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   559
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   560
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   561
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   562
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   563
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   564
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   565
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   566
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   567
    public CompletionStage<Void> acceptEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   568
        (CompletionStage<? extends T> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   569
         Consumer<? super T> action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   570
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   571
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   572
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   573
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   574
     * other given stage complete normally, executes the given action.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   575
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   576
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   577
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   578
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   579
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   580
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   581
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   582
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   583
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   584
    public CompletionStage<Void> runAfterEither(CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   585
                                                Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   586
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   587
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   588
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   589
     * other given stage complete normally, executes the given action
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   590
     * using this stage's default asynchronous execution facility.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   591
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   592
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   593
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   594
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   595
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   596
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   597
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   598
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   599
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   600
    public CompletionStage<Void> runAfterEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   601
        (CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   602
         Runnable action);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   603
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   604
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   605
     * Returns a new CompletionStage that, when either this or the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   606
     * other given stage complete normally, executes the given action
26336
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   607
     * using the supplied executor.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   608
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   609
     * See the {@link CompletionStage} documentation for rules
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   610
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   611
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   612
     * @param other the other CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   613
     * @param action the action to perform before completing the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   614
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   615
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   616
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   617
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   618
    public CompletionStage<Void> runAfterEitherAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   619
        (CompletionStage<?> other,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   620
         Runnable action,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   621
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   622
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   623
    /**
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   624
     * Returns a new CompletionStage that is completed with the same
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   625
     * value as the CompletionStage returned by the given function.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   626
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   627
     * <p>When this stage completes normally, the given function is
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   628
     * invoked with this stage's result as the argument, returning
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   629
     * another CompletionStage.  When that stage completes normally,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   630
     * the CompletionStage returned by this method is completed with
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   631
     * the same value.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   632
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   633
     * <p>To ensure progress, the supplied function must arrange
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   634
     * eventual completion of its result.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   635
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   636
     * <p>This method is analogous to
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   637
     * {@link java.util.Optional#flatMap Optional.flatMap} and
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   638
     * {@link java.util.stream.Stream#flatMap Stream.flatMap}.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   639
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   640
     * <p>See the {@link CompletionStage} documentation for rules
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   641
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   642
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   643
     * @param fn the function to use to compute another CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   644
     * @param <U> the type of the returned CompletionStage's result
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   645
     * @return the new CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   646
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   647
    public <U> CompletionStage<U> thenCompose
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   648
        (Function<? super T, ? extends CompletionStage<U>> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   649
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   650
    /**
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   651
     * Returns a new CompletionStage that is completed with the same
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   652
     * value as the CompletionStage returned by the given function,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   653
     * executed using this stage's default asynchronous execution
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   654
     * facility.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   655
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   656
     * <p>When this stage completes normally, the given function is
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   657
     * invoked with this stage's result as the argument, returning
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   658
     * another CompletionStage.  When that stage completes normally,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   659
     * the CompletionStage returned by this method is completed with
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   660
     * the same value.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   661
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   662
     * <p>To ensure progress, the supplied function must arrange
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   663
     * eventual completion of its result.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   664
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   665
     * <p>See the {@link CompletionStage} documentation for rules
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   666
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   667
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   668
     * @param fn the function to use to compute another CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   669
     * @param <U> the type of the returned CompletionStage's result
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   670
     * @return the new CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   671
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   672
    public <U> CompletionStage<U> thenComposeAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   673
        (Function<? super T, ? extends CompletionStage<U>> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   674
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   675
    /**
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   676
     * Returns a new CompletionStage that is completed with the same
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   677
     * value as the CompletionStage returned by the given function,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   678
     * executed using the supplied Executor.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   679
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   680
     * <p>When this stage completes normally, the given function is
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   681
     * invoked with this stage's result as the argument, returning
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   682
     * another CompletionStage.  When that stage completes normally,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   683
     * the CompletionStage returned by this method is completed with
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   684
     * the same value.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   685
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   686
     * <p>To ensure progress, the supplied function must arrange
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   687
     * eventual completion of its result.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   688
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   689
     * <p>See the {@link CompletionStage} documentation for rules
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   690
     * covering exceptional completion.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   691
     *
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   692
     * @param fn the function to use to compute another CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   693
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   694
     * @param <U> the type of the returned CompletionStage's result
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   695
     * @return the new CompletionStage
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   696
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   697
    public <U> CompletionStage<U> thenComposeAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   698
        (Function<? super T, ? extends CompletionStage<U>> fn,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   699
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   700
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   701
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   702
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   703
     * either normally or exceptionally, is executed with this stage's
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   704
     * result and exception as arguments to the supplied function.
26336
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   705
     *
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   706
     * <p>When this stage is complete, the given function is invoked
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   707
     * with the result (or {@code null} if none) and the exception (or
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   708
     * {@code null} if none) of this stage as arguments, and the
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   709
     * function's result is used to complete the returned stage.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   710
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   711
     * @param fn the function to use to compute the value of the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   712
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   713
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   714
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   715
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   716
    public <U> CompletionStage<U> handle
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   717
        (BiFunction<? super T, Throwable, ? extends U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   718
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   719
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   720
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   721
     * either normally or exceptionally, is executed using this stage's
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   722
     * default asynchronous execution facility, with this stage's
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   723
     * result and exception as arguments to the supplied function.
26336
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   724
     *
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   725
     * <p>When this stage is complete, the given function is invoked
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   726
     * with the result (or {@code null} if none) and the exception (or
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   727
     * {@code null} if none) of this stage as arguments, and the
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   728
     * function's result is used to complete the returned stage.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   729
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   730
     * @param fn the function to use to compute the value of the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   731
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   732
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   733
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   734
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   735
    public <U> CompletionStage<U> handleAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   736
        (BiFunction<? super T, Throwable, ? extends U> fn);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   737
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   738
    /**
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   739
     * Returns a new CompletionStage that, when this stage completes
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   740
     * either normally or exceptionally, is executed using the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   741
     * supplied executor, with this stage's result and exception as
26336
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   742
     * arguments to the supplied function.
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   743
     *
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   744
     * <p>When this stage is complete, the given function is invoked
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   745
     * with the result (or {@code null} if none) and the exception (or
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   746
     * {@code null} if none) of this stage as arguments, and the
1eee453c24c1 8056249: Improve CompletableFuture resource usage
dl
parents: 25859
diff changeset
   747
     * function's result is used to complete the returned stage.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   748
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   749
     * @param fn the function to use to compute the value of the
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   750
     * returned CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   751
     * @param executor the executor to use for asynchronous execution
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   752
     * @param <U> the function's return type
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   753
     * @return the new CompletionStage
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   754
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   755
    public <U> CompletionStage<U> handleAsync
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   756
        (BiFunction<? super T, Throwable, ? extends U> fn,
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   757
         Executor executor);
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   758
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   759
    /**
35980
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   760
     * Returns a new CompletionStage with the same result or exception as
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   761
     * this stage, that executes the given action when this stage completes.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   762
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   763
     * <p>When this stage is complete, the given action is invoked
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   764
     * with the result (or {@code null} if none) and the exception (or
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   765
     * {@code null} if none) of this stage as arguments.  The returned
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   766
     * stage is completed when the action returns.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   767
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   768
     * <p>Unlike method {@link #handle handle},
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   769
     * this method is not designed to translate completion outcomes,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   770
     * so the supplied action should not throw an exception. However,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   771
     * if it does, the following rules apply: if this stage completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   772
     * normally but the supplied action throws an exception, then the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   773
     * returned stage completes exceptionally with the supplied
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   774
     * action's exception. Or, if this stage completed exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   775
     * and the supplied action throws an exception, then the returned
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   776
     * stage completes exceptionally with this stage's exception.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   777
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   778
     * @param action the action to perform
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   779
     * @return the new CompletionStage
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   780
     */
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   781
    public CompletionStage<T> whenComplete
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   782
        (BiConsumer<? super T, ? super Throwable> action);
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   783
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   784
    /**
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   785
     * Returns a new CompletionStage with the same result or exception as
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   786
     * this stage, that executes the given action using this stage's
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   787
     * default asynchronous execution facility when this stage completes.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   788
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   789
     * <p>When this stage is complete, the given action is invoked with the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   790
     * result (or {@code null} if none) and the exception (or {@code null}
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   791
     * if none) of this stage as arguments.  The returned stage is completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   792
     * when the action returns.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   793
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   794
     * <p>Unlike method {@link #handleAsync(BiFunction) handleAsync},
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   795
     * this method is not designed to translate completion outcomes,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   796
     * so the supplied action should not throw an exception. However,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   797
     * if it does, the following rules apply: If this stage completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   798
     * normally but the supplied action throws an exception, then the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   799
     * returned stage completes exceptionally with the supplied
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   800
     * action's exception. Or, if this stage completed exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   801
     * and the supplied action throws an exception, then the returned
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   802
     * stage completes exceptionally with this stage's exception.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   803
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   804
     * @param action the action to perform
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   805
     * @return the new CompletionStage
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   806
     */
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   807
    public CompletionStage<T> whenCompleteAsync
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   808
        (BiConsumer<? super T, ? super Throwable> action);
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   809
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   810
    /**
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   811
     * Returns a new CompletionStage with the same result or exception as
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   812
     * this stage, that executes the given action using the supplied
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   813
     * Executor when this stage completes.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   814
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   815
     * <p>When this stage is complete, the given action is invoked with the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   816
     * result (or {@code null} if none) and the exception (or {@code null}
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   817
     * if none) of this stage as arguments.  The returned stage is completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   818
     * when the action returns.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   819
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   820
     * <p>Unlike method {@link #handleAsync(BiFunction,Executor) handleAsync},
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   821
     * this method is not designed to translate completion outcomes,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   822
     * so the supplied action should not throw an exception. However,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   823
     * if it does, the following rules apply: If this stage completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   824
     * normally but the supplied action throws an exception, then the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   825
     * returned stage completes exceptionally with the supplied
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   826
     * action's exception. Or, if this stage completed exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   827
     * and the supplied action throws an exception, then the returned
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   828
     * stage completes exceptionally with this stage's exception.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   829
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   830
     * @param action the action to perform
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   831
     * @param executor the executor to use for asynchronous execution
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   832
     * @return the new CompletionStage
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   833
     */
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   834
    public CompletionStage<T> whenCompleteAsync
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   835
        (BiConsumer<? super T, ? super Throwable> action,
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   836
         Executor executor);
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   837
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   838
    /**
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   839
     * Returns a new CompletionStage that, when this stage completes
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   840
     * exceptionally, is executed with this stage's exception as the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   841
     * argument to the supplied function.  Otherwise, if this stage
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   842
     * completes normally, then the returned stage also completes
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   843
     * normally with the same value.
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   844
     *
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   845
     * @param fn the function to use to compute the value of the
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   846
     * returned CompletionStage if this CompletionStage completed
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   847
     * exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   848
     * @return the new CompletionStage
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   849
     */
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   850
    public CompletionStage<T> exceptionally
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   851
        (Function<Throwable, ? extends T> fn);
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   852
1fc60a70d779 8139927: Improve documentation for CompletableFuture composition
dl
parents: 32987
diff changeset
   853
    /**
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   854
     * Returns a {@link CompletableFuture} maintaining the same
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   855
     * completion properties as this stage. If this stage is already a
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   856
     * CompletableFuture, this method may return this stage itself.
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   857
     * Otherwise, invocation of this method may be equivalent in
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   858
     * effect to {@code thenApply(x -> x)}, but returning an instance
42322
c3474fef4fe4 8166646: Miscellaneous changes imported from jsr166 CVS 2016-10
dl
parents: 35980
diff changeset
   859
     * of type {@code CompletableFuture}.
19192
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   860
     *
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   861
     * @return the CompletableFuture
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   862
     */
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   863
    public CompletableFuture<T> toCompletableFuture();
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   864
4954a5c4da01 8020291: j.u.c.CompletionStage
chegar
parents:
diff changeset
   865
}