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 795adfd1..aa9d0036 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -1330,7 +1330,7 @@ public T join() { * Waits if necessary for at most the given time for the computation to complete, * and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally. *

- * NOTE:
+ * NOTE:
* call this method *

* {@code result = cffu.join(timeout, unit);} @@ -1342,7 +1342,7 @@ public T join() { * .join(); * } * - * CAUTION:
+ * CAUTION:
* if the wait timed out, this method throws an (unchecked) {@link CompletionException} * with the {@link TimeoutException} as its cause; * NOT throws a (checked) {@link TimeoutException} like {@link #get(long, TimeUnit)}. @@ -1482,7 +1482,7 @@ public boolean isCancelled() { * Returns the computation state, this method just invoke without java version compatibility logic, * if you need this function backport into old {@code java 18-}, use {@link #cffuState()} instead. *

- * NOTE:
+ * NOTE:
* {@link CompletableFuture#state} is new method since Java 19, * this method should have compatibility logic for old Java version; * But the return type {@link Future.State} is also added since Java 19, @@ -1610,7 +1610,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { * If this CompletableFuture completes exceptionally, then the returned CompletionStage completes * exceptionally with a CompletionException with this exception as cause. *

- * CAUTION:
+ * CAUTION:
* if run on old Java 8, just return a Cffu with * a *normal* underlying CompletableFuture which is NOT with a *minimal* CompletionStage. *

@@ -1839,11 +1839,11 @@ public void obtrudeException(Throwable ex) { * Subclasses of CompletableFuture should normally override this method to return an instance of the same class * as this CompletableFuture. The default implementation returns an instance of class CompletableFuture. *

- * NOTE:
+ * NOTE:
* this method existed mainly for API compatibility to {@code CompletableFuture}, * prefer {@link CffuFactory#newIncompleteCffu()}. *

- * CAUTION:
+ * CAUTION:
* for minimal stage instance({@link #isMinimalStage()}), if run on old Java 8, * just return a Cffu with a *normal* underlying CompletableFuture which is NOT with a *minimal* CompletionStage. * diff --git a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java index d7050fee..5f2f71cd 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java @@ -92,7 +92,7 @@ public Cffu completedFuture(@Nullable T value) { * Returns a new CompletionStage that is already completed with the given value * and supports only those methods in interface {@link CompletionStage}. *

- * CAUTION:
+ * CAUTION:
* if run on old Java 8, just return a Cffu with * a *normal* underlying CompletableFuture which is NOT with a *minimal* CompletionStage. * @@ -124,7 +124,7 @@ public Cffu failedFuture(Throwable ex) { * Returns a new CompletionStage that is already completed exceptionally * with the given exception and supports only those methods in interface {@link CompletionStage}. *

- * CAUTION:
+ * CAUTION:
* if run on old Java 8, just return a Cffu with * a *normal* underlying CompletableFuture which is NOT with a *minimal* CompletionStage. * @@ -247,7 +247,7 @@ public Cffu newIncompleteCffu() { * for {@link CompletableFuture} class instances, * {@link Cffu#cffuUnwrap()} is the inverse operation to this method. *

- * NOTE, keep input stage unchanged if possible when wrap:
+ * NOTE, keep input stage unchanged if possible when wrap:
*

    *
  1. if input stage is a {@link Cffu}, re-wrapped with the config of * this {@link CffuFactory} from {@link CffuFactoryBuilder} by {@link Cffu#resetCffuFactory(CffuFactory)}. diff --git a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java index e93701bf..aa5f3123 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -21,7 +21,7 @@ /** - * This class contains the enhanced methods for {@link CompletableFuture}. + * This class contains the enhanced and backport methods for {@link CompletableFuture}. * * @author Jerry Lee (oldratlee at gmail dot com) */ @@ -462,8 +462,8 @@ public static CompletableFuture> } //////////////////////////////////////////////////////////////////////////////// - //# Backport CF methods - // compatibility for low Java version + //# Backport CF static methods + // compatibility for low Java versions //////////////////////////////////////////////////////////////////////////////// //# Factory methods @@ -489,7 +489,7 @@ public static CompletableFuture failedFuture(Throwable ex) { * Returns a new CompletionStage that is already completed with the given value * and supports only those methods in interface {@link CompletionStage}. *

    - * CAUTION:
    + * CAUTION:
    * if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage. * * @param value the value @@ -508,7 +508,7 @@ public static CompletionStage completedStage(@Nullable T value) { * Returns a new CompletionStage that is already completed exceptionally with * the given exception and supports only those methods in interface {@link CompletionStage}. *

    - * CAUTION:
    + * CAUTION:
    * if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage. * * @param ex the exception @@ -562,7 +562,7 @@ public static Executor delayedExecutor(long delay, TimeUnit unit, Executor execu } //////////////////////////////////////// - //# backport instance methods + //# Backport CF instance methods //////////////////////////////////////// //# Error Handling methods of CompletionStage @@ -718,7 +718,7 @@ public static CompletableFuture exceptionallyComposeAsync( * Waits if necessary for at most the given time for the computation to complete, * and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally. *

    - * NOTE:
    + * NOTE:
    * call this method *

    * {@code result = CompletableFutureUtils.join(cf, timeout, unit);} @@ -730,7 +730,7 @@ public static CompletableFuture exceptionallyComposeAsync( * .join(); * } * - * CAUTION:
    + * CAUTION:
    * if the wait timed out, this method throws an (unchecked) {@link CompletionException} * with the {@link TimeoutException} as its cause; * NOT throws a (checked) {@link TimeoutException} like {@link CompletableFuture#get(long, TimeUnit)}. @@ -913,7 +913,7 @@ public static CompletableFuture completeAsync( * If given CompletableFuture completes exceptionally, then the returned CompletionStage completes exceptionally * with a CompletionException with given exception as cause. *

    - * CAUTION:
    + * CAUTION:
    * if run on old Java 8, just return a *normal* CompletableFuture which is NOT with a *minimal* CompletionStage. * * @return the new CompletionStage @@ -963,7 +963,7 @@ public static CompletableFuture newIncompleteFuture(CompletableFuture< * Returns the default Executor used for async methods that do not specify an Executor. * This class uses the {@link ForkJoinPool#commonPool()} if it supports more than one parallel thread, * or else an Executor using one thread per async task.
    - * CAUTION:This executor may be not suitable for common biz use(io intensive). + * CAUTION: This executor may be not suitable for common biz use(io intensive). * * @return the executor */ diff --git a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt index d0bff955..f8de3c76 100644 --- a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt +++ b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CffuExtensions.kt @@ -64,7 +64,7 @@ private const val ERROR_MSG_FOR_COLL = "no cffuFactory argument provided when th private const val ERROR_MSG_FOR_ARRAY = "no cffuFactory argument provided when this array is empty" /** - * Returns a new Cffu with the results in the same order of all the given Cffus, + * Returns a new Cffu with the results in the **same order** of all the given Cffus, * the new Cffu is completed when all the given Cffus complete. * If any of the given Cffus complete exceptionally, then the returned Cffu * also does so, with a CompletionException holding this exception as its cause. @@ -86,7 +86,7 @@ fun Collection>.allResultsOfCffu(cffuFactory: CffuFactory = ABSE } /** - * Returns a new Cffu with the results in the same order of all the given Cffus, + * Returns a new Cffu with the results in the **same order** of all the given Cffus, * the new Cffu is completed when all the given Cffus complete. * If any of the given Cffus complete exceptionally, then the returned Cffu * also does so, with a CompletionException holding this exception as its cause. @@ -108,7 +108,7 @@ fun Array>.allResultsOfCffu(cffuFactory: CffuFactory = ABSEN } /** - * Returns a new Cffu with the results in the same order of all the given CompletableFutures, + * Returns a new Cffu with the results in the **same order** of all the given CompletableFutures, * the new Cffu is completed when all the given CompletableFutures complete. * If any of the given CompletableFutures complete exceptionally, then the returned Cffu * also does so, with a CompletionException holding this exception as its cause. @@ -125,7 +125,7 @@ fun Collection>.allResultsOfCffu(cffuFactory: CffuF cffuFactory.allResultsOf(*this.toTypedArray()) /** - * Returns a new Cffu with the results in the same order of all the given CompletableFutures, + * Returns a new Cffu with the results in the **same order** of all the given CompletableFutures, * the new Cffu is completed when all the given CompletableFutures complete. * If any of the given CompletableFutures complete exceptionally, then the returned Cffu * also does so, with a CompletionException holding this exception as its cause. @@ -219,7 +219,7 @@ fun Array>.allOfCffu(cffuFactory: CffuFactory): Cffusame order of all the given Cffus, + * Returns a new Cffu with the results in the **same order** of all the given Cffus, * the new Cffu success when all the given Cffus success. * If any of the given Cffus complete exceptionally, then the returned Cffu * also does so *without* waiting other incomplete given Cffus, @@ -242,7 +242,7 @@ fun Collection>.allResultsOfFastFailCffu(cffuFactory: CffuFactor } /** - * Returns a new Cffu with the results in the same order of all the given Cffus, + * Returns a new Cffu with the results in the **same order** of all the given Cffus, * the new Cffu success when all the given Cffus success. * If any of the given Cffus complete exceptionally, then the returned Cffu * also does so *without* waiting other incomplete given Cffus, @@ -265,7 +265,7 @@ fun Array>.allResultsOfFastFailCffu(cffuFactory: CffuFactory } /** - * Returns a new Cffu with the results in the same order of all the given CompletableFutures, + * Returns a new Cffu with the results in the **same order** of all the given CompletableFutures, * the new Cffu success when all the given CompletableFutures success. * If any of the given CompletableFutures complete exceptionally, then the returned Cffu * also does so *without* waiting other incomplete given CompletableFutures, @@ -283,7 +283,7 @@ fun Collection>.allResultsOfFastFailCffu(cffuFactor cffuFactory.allResultsOfFastFail(*this.toTypedArray()) /** - * Returns a new Cffu with the results in the same order of all the given CompletableFutures, + * Returns a new Cffu with the results in the **same order** of all the given CompletableFutures, * the new Cffu success when all the given CompletableFutures success. * If any of the given CompletableFutures complete exceptionally, then the returned Cffu * also does so *without* waiting other incomplete given CompletableFutures, diff --git a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt index c9ae9c5f..d03a21e6 100644 --- a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt +++ b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt @@ -31,7 +31,7 @@ import java.util.function.Supplier //////////////////////////////////////// /** - * Returns a new CompletableFuture with the results in the same order of all the given + * Returns a new CompletableFuture with the results in the **same order** of all the given * CompletableFutures, the returned new CompletableFuture is completed when all the given CompletableFutures complete. * If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture * also does so, with a CompletionException holding this exception as its cause. @@ -48,7 +48,7 @@ fun Collection>.allResultsOfCompletableFuture(): Co CompletableFutureUtils.allResultsOf(*this.toTypedArray()) /** - * Returns a new CompletableFuture with the results in the same order of all the given + * Returns a new CompletableFuture with the results in the **same order** of all the given * CompletableFutures, the returned new CompletableFuture is completed when all the given CompletableFutures complete. * If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture * also does so, with a CompletionException holding this exception as its cause. @@ -109,7 +109,7 @@ fun Array>.allOfCompletableFuture(): CompletableFuture< CompletableFuture.allOf(*this) /** - * Returns a new CompletableFuture with the results in the same order of all the given + * Returns a new CompletableFuture with the results in the **same order** of all the given * CompletableFutures, the new CompletableFuture success when all the given CompletableFutures success. * If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture * also does so *without* waiting other incomplete given CompletableFutures, @@ -127,7 +127,7 @@ fun Collection>.allResultsOfFastFailCompletableFutu CompletableFutureUtils.allResultsOfFastFail(*this.toTypedArray()) /** - * Returns a new CompletableFuture with the results in the same order of all the given + * Returns a new CompletableFuture with the results in the **same order** of all the given * CompletableFutures, the new CompletableFuture success when all the given CompletableFutures success. * If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture * also does so *without* waiting other incomplete given CompletableFutures, @@ -491,9 +491,8 @@ fun CompletableFuture.exceptionallyComposeAsync( /** * Waits if necessary for at most the given time for the computation to complete, * and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally. - *

    - * NOTE:
    - * call this method + * + * **NOTE:** call this method * * `result = CompletableFutureUtils.join(cf, timeout, unit);` * @@ -506,8 +505,7 @@ fun CompletableFuture.exceptionallyComposeAsync( * } * ``` * - * CAUTION:
    - * if the wait timed out, this method throws an (unchecked) CompletionException with the TimeoutException as its cause; + * **CAUTION:** if the wait timed out, this method throws an (unchecked) CompletionException with the TimeoutException as its cause; * NOT throws a (checked) TimeoutException like [CompletableFuture.get]. * * @param timeout the maximum time to wait @@ -521,7 +519,7 @@ fun CompletableFuture.join(timeout: Long, unit: TimeUnit): T = /** * Returns the computed result, without waiting. - *

    + * * This method is for cases where the caller knows that the task has already completed successfully, * for example when filtering a stream of Future objects for the successful tasks * and using a mapping operation to obtain a stream of results. @@ -540,7 +538,7 @@ fun CompletableFuture.resultNow(): T = /** * Returns the exception thrown by the task, without waiting. - *

    + * * This method is for cases where the caller knows that the task has already completed with an exception. * * @return the exception thrown by the task