From b674fd958683dd7b7ccfd82470aaea0deca6bf05 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Sun, 2 Jun 2024 20:08:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20delegate=20`Cffu.peek()`=20methods?= =?UTF-8?q?=20to=20`CompletableFutureUtils.peek()`=20which=20has=20report?= =?UTF-8?q?=20function=20=F0=9F=AB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cffu-core/src/main/java/io/foldright/cffu/Cffu.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java index f26f175d..621739b2 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -1198,7 +1198,7 @@ public Cffu exceptionallyComposeAsync( * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenComplete`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peek`") @Override public Cffu handle(BiFunction fn) { return reset0(cf.handle(fn)); @@ -1217,7 +1217,7 @@ public Cffu handle(BiFunction fn) { * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenCompleteAsync`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") @Override public Cffu handleAsync(BiFunction fn) { return handleAsync(fn, fac.defaultExecutor()); @@ -1237,7 +1237,7 @@ public Cffu handleAsync(BiFunction fn) * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenCompleteAsync`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") @Override public Cffu handleAsync( BiFunction fn, Executor executor) { @@ -1263,6 +1263,7 @@ public Cffu handleAsync( * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peek`") public Cffu whenComplete(BiConsumer action) { return reset0(cf.whenComplete(action)); } @@ -1288,6 +1289,7 @@ public Cffu whenComplete(BiConsumer action) { * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu whenCompleteAsync(BiConsumer action) { return whenCompleteAsync(action, fac.defaultExecutor()); } @@ -1313,6 +1315,7 @@ public Cffu whenCompleteAsync(BiConsumer action * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu whenCompleteAsync(BiConsumer action, Executor executor) { return reset0(cf.whenCompleteAsync(action, executor)); } @@ -1334,7 +1337,7 @@ public Cffu whenCompleteAsync(BiConsumer action * @see java.util.stream.Stream#peek(Consumer) */ public Cffu peek(BiConsumer action) { - cf.whenComplete(action); + CompletableFutureUtils.peek(cf, action); return this; } @@ -1377,7 +1380,7 @@ public Cffu peekAsync(BiConsumer action) { * @see java.util.stream.Stream#peek(Consumer) */ public Cffu peekAsync(BiConsumer action, Executor executor) { - cf.whenCompleteAsync(action, executor); + CompletableFutureUtils.peekAsync(cf, action, executor); return this; }