Class CffuFactory

java.lang.Object
io.foldright.cffu2.CffuFactory

@ThreadSafe public final class CffuFactory extends Object
This class CffuFactory is equivalent to CompletableFuture, contains the static (factory) methods of CompletableFuture.

The methods that equivalent to the instance methods of CompletableFuture is in Cffu class.

Use builder(Executor) to config and build CffuFactory.

About factory methods convention of CffuFactory:

Author:
Jerry Lee (oldratlee at gmail dot com), HuHao (995483610 at qq dot com)
See Also:
  • Method Details

    • builder

      @Contract(pure=true) public static CffuFactoryBuilder builder(Executor defaultExecutor)
      Returns a CffuFactoryBuilder with defaultExecutor setting.
      See Also:
    • withDefaultExecutor

      @Contract(pure=true) public CffuFactory withDefaultExecutor(Executor defaultExecutor)
      Returns a new CffuFactory from this CffuFactory with the defaultExecutor.
    • supplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `mRunAsyncAndForget`") public <T> Cffu<T> supplyAsync(Supplier<T> supplier)
      Returns a new Cffu that is asynchronously completed by a task running in the defaultExecutor() with the value obtained by calling the given Supplier.
      Type Parameters:
      T - the function's return type
      Parameters:
      supplier - a function returning the value to be used to complete the returned Cffu
    • supplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `mRunAsyncAndForget`") public <T> Cffu<T> supplyAsync(Supplier<T> supplier, Executor executor)
      Returns a new Cffu that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier.
      Type Parameters:
      T - the function's return type
      Parameters:
      supplier - a function returning the value to be used to complete the returned Cffu
      executor - the executor to use for asynchronous execution
    • runAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `mRunAsyncAndForget`") public Cffu<Void> runAsync(Runnable action)
      Returns a new Cffu that is asynchronously completed by a task running in the defaultExecutor() after it runs the given action.
      Parameters:
      action - the action to run before completing the returned Cffu
    • runAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `mRunAsyncAndForget`") public Cffu<Void> runAsync(Runnable action, Executor executor)
      Returns a new Cffu that is asynchronously completed by a task running in the given executor after it runs the given action.
      Parameters:
      action - the action to run before completing the returned Cffu
      executor - the executor to use for asynchronous execution
    • mSupplyFailFastAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyFailFastAsync(Supplier<? extends E>... suppliers)
      Shortcut to method allResultsFailFastOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the allResultsFailFastOf documentation for the rules of result computation.

    • mSupplyFailFastAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyFailFastAsync(Executor executor, Supplier<? extends E>... suppliers)
      Shortcut to method allResultsFailFastOf, wraps input suppliers to Cffu by supplyAsync(Supplier, Executor).

      See the allResultsFailFastOf documentation for the rules of result computation.

    • mSupplyAllSuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyAllSuccessAsync(@Nullable E valueIfFailed, Supplier<? extends E>... suppliers)
      Shortcut to method allSuccessResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the allSuccessResultsOf documentation for the rules of result computation.

    • mSupplyAllSuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyAllSuccessAsync(Executor executor, @Nullable E valueIfFailed, Supplier<? extends E>... suppliers)
      Shortcut to method allSuccessResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier, Executor).

      See the allSuccessResultsOf documentation for the rules of result computation.

    • mSupplyMostSuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyMostSuccessAsync(@Nullable E valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends E>... suppliers)
      Shortcut to method mostSuccessResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the mostSuccessResultsOf documentation for the rules of result computation.

    • mSupplyMostSuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyMostSuccessAsync(Executor executor, @Nullable E valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends E>... suppliers)
      Shortcut to method mostSuccessResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the mostSuccessResultsOf documentation for the rules of result computation.

    • mSupplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyAsync(Supplier<? extends E>... suppliers)
      Shortcut to method allResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the allResultsOf documentation for the rules of result computation.

    • mSupplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <E> MCffu<E,List<E>> mSupplyAsync(Executor executor, Supplier<? extends E>... suppliers)
      Shortcut to method allResultsOf, wraps input suppliers to Cffu by supplyAsync(Supplier, Executor).

      See the allResultsOf documentation for the rules of result computation.

    • mSupplyAnySuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <T> Cffu<T> mSupplyAnySuccessAsync(Supplier<? extends T>... suppliers)
      Shortcut to method anySuccessOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the anySuccessOf documentation for the rules of result computation.

    • mSupplyAnySuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <T> Cffu<T> mSupplyAnySuccessAsync(Executor executor, Supplier<? extends T>... suppliers)
      Shortcut to method anySuccessOf, wraps input suppliers to Cffu by supplyAsync(Supplier, Executor).

      See the anySuccessOf documentation for the rules of result computation.

    • mSupplyAnyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <T> Cffu<T> mSupplyAnyAsync(Supplier<? extends T>... suppliers)
      Shortcut to method anyOf, wraps input suppliers to Cffu by supplyAsync(Supplier).

      See the anySuccessOf documentation for the rules of result computation.

    • mSupplyAnyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") @SafeVarargs public final <T> Cffu<T> mSupplyAnyAsync(Executor executor, Supplier<? extends T>... suppliers)
      Shortcut to method anySuccessOf, wraps input suppliers to Cffu by supplyAsync(Supplier, Executor).

      See the anyOf documentation for the rules of result computation.

    • mRunFailFastAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunFailFastAsync(Runnable... actions)
      Shortcut to method allFailFastOf, wraps input actions to Cffu by runAsync(Runnable).

      See the allFailFastOf documentation for the rules of result computation.

    • mRunFailFastAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunFailFastAsync(Executor executor, Runnable... actions)
      Shortcut to method allFailFastOf, wraps input actions to Cffu by runAsync(Runnable, Executor).

      See the allFailFastOf documentation for the rules of result computation.

    • mRunAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAsync(Runnable... actions)
      Shortcut to method allOf, wraps input actions to Cffu by runAsync(Runnable).

      See the allOf documentation for the rules of result computation.

    • mRunAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAsync(Executor executor, Runnable... actions)
      Shortcut to method allOf, wraps input actions to Cffu by runAsync(Runnable, Executor).

      See the allOf documentation for the rules of result computation.

    • mRunAnySuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAnySuccessAsync(Runnable... actions)
      Shortcut to method anySuccessOf, wraps input actions to Cffu by runAsync(Runnable).

      See the anySuccessOf documentation for the rules of result computation.

    • mRunAnySuccessAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAnySuccessAsync(Executor executor, Runnable... actions)
      Shortcut to method anySuccessOf, wraps input actions to Cffu by runAsync(Runnable, Executor).

      See the anySuccessOf documentation for the rules of result computation.

    • mRunAnyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAnyAsync(Runnable... actions)
      Shortcut to method anyOf, wraps input actions to Cffu by runAsync(Runnable).

      See the anyOf documentation for the rules of result computation.

    • mRunAnyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, use method `mRunAsyncAndForget`") public Cffu<Void> mRunAnyAsync(Executor executor, Runnable... actions)
      Shortcut to method anyOf, wraps input actions to Cffu by runAsync(Runnable, Executor).

      See the anyOf documentation for the rules of result computation.

    • mRunAsyncAndForget

      public void mRunAsyncAndForget(Runnable... actions)
      Runs all input actions async and forget (return void). This method explicitly indicates that the caller will not care about any exceptions from actions and will not wait for the computations to complete ("fire-and-forget").
      Since:
      2.1.0
    • mRunAsyncAndForget

      public void mRunAsyncAndForget(Executor executor, Runnable... actions)
      Runs all input actions async and forget (return void). This method explicitly indicates that the caller will not care about any exceptions from actions and will not wait for the computations to complete ("fire-and-forget").
      Since:
      2.1.0
    • allResultsFailFastOf

      @Contract(pure=true) @SafeVarargs public final <T> MCffu<T,List<T>> allResultsFailFastOf(CompletionStage<? extends T>... cfs)
      Returns a new Cffu that is completed normally with a list containing the successful results of all given stages when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned Cffu also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value empty list.

      The list of results is in the same order as the input list.

      This method is the same as allResultsOf method except for the fail-fast behavior.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
      See Also:
    • allSuccessResultsOf

      @Contract(pure=true) @SafeVarargs public final <T> MCffu<T,List<T>> allSuccessResultsOf(@Nullable T valueIfFailed, CompletionStage<? extends T>... cfs)
      Returns a new Cffu that is completed normally with a list containing the successful results of all given stages when all the given stages complete; The list of results is in the same order as the input list, and if any of given stages complete exceptionally, their corresponding position will contain valueIfFailed (which is indistinguishable from the stage having a successful value of valueIfFailed). If no stages are provided, returns a Cffu completed with the value empty list.

      The list of results is in the same order as the input list.

      This method differs from allResultsFailFastOf method in that it's tolerant of failed stages for any of the items, representing them as valueIfFailed in the result list.

      Parameters:
      valueIfFailed - the value used as the result if the input stage completed exceptionally
      Throws:
      NullPointerException - if the cfs param or any of its elements is null
      See Also:
    • mostSuccessResultsOf

      @Contract(pure=true) @SafeVarargs public final <T> MCffu<T,List<T>> mostSuccessResultsOf(@Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, CompletionStage<? extends T>... cfs)
      Returns a new Cffu that is completed normally with a list containing the successful results of the given stages before the given timeout, i.e. as many results as possible in the given time; The list of results is in the same order as the input list, and if any of given stages complete exceptionally or are incomplete, their corresponding positions will contain valueIfNotSuccess (which is indistinguishable from the stage having a successful value of valueIfNotSuccess). If no stages are provided, returns a Cffu completed with the value empty list.

      The list of results is in the same order as the input list.

      This method differs from allResultsFailFastOf method in that it's tolerant of failed or incomplete stages for any of the items, representing them as valueIfNotSuccess in the result list.

      Parameters:
      valueIfNotSuccess - the value used as the result if the input stage not completed normally
      timeout - how long to wait in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Throws:
      NullPointerException - if the cfs param or any of its elements are null
      See Also:
    • allResultsOf

      @Contract(pure=true) @SafeVarargs public final <T> MCffu<T,List<T>> allResultsOf(CompletionStage<? extends T>... cfs)
      Returns a new Cffu that is completed normally with a list containing the successful results of all given stages when all the given stages complete; If any of the given stages complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value empty list.

      The list of results is in the same order as the input list.

      Comparing the waiting-all-complete behavior of this method, the fail-fast behavior of allResultsFailFastOf method is more responsive to user and generally more desired in the application.

      This method is the same as allOf method, except that the returned Cffu contains the results of the given stages.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
    • allFailFastOf

      @Contract(pure=true) public Cffu<Void> allFailFastOf(CompletionStage<?>... cfs)
      Returns a new Cffu that is completed normally when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned Cffu also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value null.

      The successful results, if any, of the given stages are not reflected in the returned Cffu (Cffu<Void>), but may be obtained by inspecting them individually; Or using the below methods reflected results in the returned Cffu which are more convenient, safer and best-practice of concurrency:

      This method is the same as allOf method except for the fail-fast behavior.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
      See Also:
    • allOf

      @CheckReturnValue(explanation="should use the returned Cffu; forget to call its `join()` method?") @Contract(pure=true) public Cffu<Void> allOf(CompletionStage<?>... cfs)
      Returns a new Cffu that is completed when all the given stages complete; If any of the given stages complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value null.

      The successful results, if any, of the given stages are not reflected in the returned Cffu (Cffu<Void>), but may be obtained by inspecting them individually; Or using the below methods reflected results in the returned Cffu which are more convenient, safer and best-practice of concurrency:

      Among the applications of this method is to await completion of a set of independent stages before continuing a program, as in: cffuFactory.allOf(c1, c2, c3).join();.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
      See Also:
    • anySuccessOf

      @SafeVarargs public final <T> Cffu<T> anySuccessOf(CompletionStage<? extends T>... cfs)
      Returns a new Cffu that completed normally when any of the given stages complete normally, with the same result; Otherwise, when all the given stages complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of the given stages as its cause. If no stages are provided, returns a new Cffu that is already completed exceptionally with a NoCfsProvidedException.

      This method differs from anyOf method in that this method is any-success instead of the any-complete behavior of method anyOf.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
    • anyOf

      @Contract(pure=true) @SafeVarargs public final <T> Cffu<T> anyOf(CompletionStage<? extends T>... cfs)
      Returns a new Cffu that is completed when any of the given stages complete, with the same result. Otherwise, if it completed exceptionally, the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns an incomplete Cffu.

      Comparing the any-complete behavior of this method, the any-success behavior of method anySuccessOf is more responsive to user and generally more desired in the application.

      Throws:
      NullPointerException - if the cfs param or any of its elements are null
    • completedFuture

      @Contract(pure=true) public <T> Cffu<T> completedFuture(@Nullable T value)
      Returns a new Cffu that is already completed with the given value.
      Type Parameters:
      T - The result type returned future
      Parameters:
      value - the value
      Returns:
      the completed Cffu
      See Also:
    • failedFuture

      @Contract(pure=true) public <T> Cffu<T> failedFuture(Throwable ex)
      Returns a new Cffu that is already completed exceptionally with the given exception.
      Type Parameters:
      T - The result type returned future
      Parameters:
      ex - the exception
      Returns:
      the exceptionally completed Cffu
      See Also:
    • completedMCffu

      @Contract(pure=true) public <E, T extends Iterable<? extends E>> MCffu<E,T> completedMCffu(@Nullable T value)
      Returns a new MCffu that is already completed with the given value.
      Type Parameters:
      E - the data element type of result collection
      T - The result collection type returned future
      Parameters:
      value - the value
      Returns:
      the completed MCffu
      See Also:
    • failedMCffu

      @Contract(pure=true) public <E, T extends Iterable<? extends E>> MCffu<E,T> failedMCffu(Throwable ex)
      Returns a new MCffu that is already completed exceptionally with the given exception.
      Type Parameters:
      E - the data element type of result collection
      T - The result collection type returned future
      Parameters:
      ex - the exception
      Returns:
      the exceptionally completed MCffu
      See Also:
    • completedStage

      @Contract(pure=true) public <T> CompletionStage<T> completedStage(@Nullable T value)
      Returns a new CompletionStage that is already completed with the given value and supports only those methods in interface CompletionStage.

      CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* Cffu instance which is NOT a *minimal* CompletionStage.

      Type Parameters:
      T - The result type returned future
      Parameters:
      value - the value
      Returns:
      the completed CompletionStage
    • failedStage

      @Contract(pure=true) public <T> CompletionStage<T> failedStage(Throwable ex)
      Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interface CompletionStage.

      CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* Cffu instance which is NOT a *minimal* CompletionStage.

      Type Parameters:
      T - The result type returned future
      Parameters:
      ex - the exception
      Returns:
      the exceptionally completed CompletionStage
    • fromSyncCall

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, run directly instead of wrapping") public <T> Cffu<T> fromSyncCall(Callable<? extends T> callable)
      Returns a new Cffu that encapsulates the execution of synchronous logic. By wrapping synchronous code in a Cffu, exceptions can be handled consistently within the Cffu pipeline, eliminating the need to manage separate exceptional paths both inside and outside the flow.
      Throws:
      NullPointerException - if argument callable is null
      See Also:
    • mCffuFromSyncCall

      @CheckReturnValue(explanation="should use the returned MCffu; otherwise, run directly instead of wrapping") public <E, T extends Iterable<? extends E>> MCffu<E,T> mCffuFromSyncCall(Callable<? extends T> callable)
      Returns a new MCffu that encapsulates the execution of synchronous logic. By wrapping synchronous code in a MCffu, exceptions can be handled consistently within the MCffu pipeline, eliminating the need to manage separate exceptional paths both inside and outside the flow.
      Throws:
      NullPointerException - if argument callable is null
      See Also:
    • toCffu

      @Contract(pure=true) public <T> Cffu<T> toCffu(CompletionStage<T> stage)
      Returns a Cffu that maintains the same completion properties as the given stage, configured with this CffuFactory. If the given stage is already a Cffu and uses this CffuFactory, this method may return the given stage.
      Throws:
      NullPointerException - if the given stage is null
      See Also:
    • toMCffu

      @Contract(pure=true) public <E, T extends Iterable<? extends E>> MCffu<E,T> toMCffu(CompletionStage<T> stage)
      Returns a MCffu that maintains the same completion properties as the given stage, configured with this CffuFactory. If the given stage is already a MCffu and uses this CffuFactory, this method may return the given stage.

      This method is similar as toCffu(CompletionStage) but return type MCffu instead of Cffu.

      Throws:
      NullPointerException - if the given stage is null
      See Also:
    • newIncompleteCffu

      @Contract(pure=true) public <T> Cffu<T> newIncompleteCffu()
      Returns a new incomplete Cffu.

      In general, you won't use this method in application code, prefer other factory methods.

      See Also:
    • newIncompleteMCffu

      @Contract(pure=true) public <E, T extends Iterable<? extends E>> MCffu<E,T> newIncompleteMCffu()
      Returns a new incomplete MCffu.

      In general, you won't use this method in application code, prefer other factory methods.

      See Also:
    • delayedExecutor

      @Contract(pure=true) public Executor delayedExecutor(long delay, TimeUnit unit)
      Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's execute method.
      Parameters:
      delay - how long to delay, in units of unit
      unit - a TimeUnit determining how to interpret the delay parameter
      Returns:
      the new delayed executor
    • delayedExecutor

      @Contract(pure=true) public Executor delayedExecutor(long delay, TimeUnit unit, Executor executor)
      Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor's execute method.
      Parameters:
      delay - how long to delay, in units of unit
      unit - a TimeUnit determining how to interpret the delay parameter
      executor - the base executor
      Returns:
      the new delayed executor
    • concurrencyLimitExecutor

      @Contract(pure=true) public Executor concurrencyLimitExecutor(int maxConcurrency)
      Returns a new Executor that submits a task to the default executor and limits the number of concurrent tasks.
      Parameters:
      maxConcurrency - the maximum number of tasks that can run concurrently
      Returns:
      the new concurrency limit executor
      Since:
      2.1.0
    • concurrencyLimitExecutor

      @Contract(pure=true) public Executor concurrencyLimitExecutor(int maxConcurrency, Executor executor)
      Returns a new Executor that submits a task to the given base executor and limits the number of concurrent tasks.
      Parameters:
      maxConcurrency - the maximum number of tasks that can run concurrently
      executor - the base executor
      Returns:
      the new concurrency limit executor
      Since:
      2.1.0
    • sequentialExecutor

      @Contract(pure=true) public Executor sequentialExecutor()
      Returns an Executor that submits a task to the default executor and runs each task executed sequentially, such that no two tasks are running concurrently.

      NOTE: Calling this method cffuFactory.sequentialExecutor() is the same as cffuFactory.concurrencyLimitExecutor(1).

      Returns:
      the new sequential executor
      Since:
      2.1.0
      See Also:
    • sequentialExecutor

      @Contract(pure=true) public Executor sequentialExecutor(Executor executor)
      Returns an Executor that submits a task to the given base executor and runs each task executed sequentially, such that no two tasks are running concurrently.

      NOTE: Calling this method cffuFactory.sequentialExecutor(executor) is the same as cffuFactory.concurrencyLimitExecutor(1, executor).

      Returns:
      the new sequential executor
      Since:
      2.1.0
      See Also:
    • defaultExecutor

      @Contract(pure=true) public Executor defaultExecutor()
      Returns the default Executor used for async methods that do not specify an Executor. Configured by builder(Executor).
      Returns:
      the default executor
      See Also:
    • forbidObtrudeMethods

      @Contract(pure=true) public boolean forbidObtrudeMethods()
      Returns forbidObtrudeMethods or not.
      See Also:
    • iterableOps

      public CffuFactory.IterableOps iterableOps()
      Returns a CffuFactory.IterableOps instance to access the Iterable-based variants (including Collection, List, etc.) of same-named varargs methods from CffuFactory. These methods handle multiple actions and Futures with the same type, aka. homogeneous.
      See Also:
    • parOps

      public CffuFactory.ParOps parOps()
      Returns a CffuFactory.ParOps instance to access the methods for parallel data processing.
      See Also:
    • tupleOps

      public CffuFactory.TupleOps tupleOps()
      Returns a CffuFactory.TupleOps instance to access the tuple-based variants of methods from CffuFactory for processing and composing multiple asynchronous actions and CompletableFutures in a type-safe manner.
      See Also: