软件包 | 描述 |
---|---|
java.util.concurrent |
在并发编程中常用的实用类。
|
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
CompletableFuture.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) |
CompletableFuture<Void> |
CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) |
CompletableFuture<Void> |
CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) |
static CompletableFuture<Void> |
CompletableFuture.allOf(CompletableFuture<?>... cfs)
返回一个新的completablefuture,完成时,所有的completablefutures完整了。
|
static CompletableFuture<Object> |
CompletableFuture.anyOf(CompletableFuture<?>... cfs)
返回一个新的completablefuture,完成时,任何给定的completablefutures完整,具有相同的结果。
|
<U> CompletableFuture<U> |
CompletableFuture.applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor) |
static <U> CompletableFuture<U> |
CompletableFuture.completedFuture(U value)
返回一个新的completablefuture已经完成与给定值。
|
CompletableFuture<T> |
CompletableFuture.exceptionally(Function<Throwable,? extends T> fn)
返回一个新的completablefuture,完成这completablefuture完成时,随着异常触发这completablefuture完成时完成给定的功能异常的结果;否则,如果这completablefuture正常结束,然后返回completablefuture也正常完成相同的值的。
|
<U> CompletableFuture<U> |
CompletableFuture.handle(BiFunction<? super T,Throwable,? extends U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.handleAsync(BiFunction<? super T,Throwable,? extends U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor) |
CompletableFuture<Void> |
CompletableFuture.runAfterBoth(CompletionStage<?> other, Runnable action) |
CompletableFuture<Void> |
CompletableFuture.runAfterBothAsync(CompletionStage<?> other, Runnable action) |
CompletableFuture<Void> |
CompletableFuture.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) |
CompletableFuture<Void> |
CompletableFuture.runAfterEither(CompletionStage<?> other, Runnable action) |
CompletableFuture<Void> |
CompletableFuture.runAfterEitherAsync(CompletionStage<?> other, Runnable action) |
CompletableFuture<Void> |
CompletableFuture.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) |
static CompletableFuture<Void> |
CompletableFuture.runAsync(Runnable runnable)
返回一个新的completablefuture是由一个任务运行在
ForkJoinPool.commonPool() 它运行的特定动作完成后异步。
|
static CompletableFuture<Void> |
CompletableFuture.runAsync(Runnable runnable, Executor executor)
返回一个新的completablefuture是由一个任务运行在给定的执行器运行了异步完成动作后。
|
static <U> CompletableFuture<U> |
CompletableFuture.supplyAsync(Supplier<U> supplier)
返回一个新的completablefuture是由任务通过调用给定的供应商获得的价值
ForkJoinPool.commonPool() 异步运行完成。
|
static <U> CompletableFuture<U> |
CompletableFuture.supplyAsync(Supplier<U> supplier, Executor executor)
返回一个新的completablefuture是由任务在给定的执行器通过调用给定的供应商获得的值异步运行完成。
|
CompletableFuture<Void> |
CompletableFuture.thenAccept(Consumer<? super T> action) |
CompletableFuture<Void> |
CompletableFuture.thenAcceptAsync(Consumer<? super T> action) |
CompletableFuture<Void> |
CompletableFuture.thenAcceptAsync(Consumer<? super T> action, Executor executor) |
<U> CompletableFuture<Void> |
CompletableFuture.thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action) |
<U> CompletableFuture<Void> |
CompletableFuture.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action) |
<U> CompletableFuture<Void> |
CompletableFuture.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor) |
<U> CompletableFuture<U> |
CompletableFuture.thenApply(Function<? super T,? extends U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.thenApplyAsync(Function<? super T,? extends U> fn) |
<U> CompletableFuture<U> |
CompletableFuture.thenApplyAsync(Function<? super T,? extends U> fn, Executor executor) |
<U,V> CompletableFuture<V> |
CompletableFuture.thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn) |
<U,V> CompletableFuture<V> |
CompletableFuture.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn) |
<U,V> CompletableFuture<V> |
CompletableFuture.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor) |
<U> CompletableFuture<U> |
CompletableFuture.thenCompose(Function<? super T,? extends CompletionStage<U>> fn) |
<U> CompletableFuture<U> |
CompletableFuture.thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn) |
<U> CompletableFuture<U> |
CompletableFuture.thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor) |
CompletableFuture<Void> |
CompletableFuture.thenRun(Runnable action) |
CompletableFuture<Void> |
CompletableFuture.thenRunAsync(Runnable action) |
CompletableFuture<Void> |
CompletableFuture.thenRunAsync(Runnable action, Executor executor) |
CompletableFuture<T> |
CompletionStage.toCompletableFuture()
返回一个
CompletableFuture 保持相同特性,这一阶段完成。
|
CompletableFuture<T> |
CompletableFuture.toCompletableFuture()
返回此completablefuture
|
CompletableFuture<T> |
CompletableFuture.whenComplete(BiConsumer<? super T,? super Throwable> action) |
CompletableFuture<T> |
CompletableFuture.whenCompleteAsync(BiConsumer<? super T,? super Throwable> action) |
CompletableFuture<T> |
CompletableFuture.whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor) |
Modifier and Type | Method and Description |
---|---|
static CompletableFuture<Void> |
CompletableFuture.allOf(CompletableFuture<?>... cfs)
返回一个新的completablefuture,完成时,所有的completablefutures完整了。
|
static CompletableFuture<Object> |
CompletableFuture.anyOf(CompletableFuture<?>... cfs)
返回一个新的completablefuture,完成时,任何给定的completablefutures完整,具有相同的结果。
|
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.