foldright / cffu

🦝 Java CompletableFuture-Fu(CF-Fu, pronounced "Shifu"), a tiny sidekick library to make CompletableFuture usage more convenient, more efficient and safer in your application. 😋🚀🦺
https://github.com/foldright/cffu
Apache License 2.0
156 stars 21 forks source link

Consider removing methods using common pool #213

Closed linzee1 closed 2 days ago

linzee1 commented 1 month ago
image

I saw some methods do not require user to pass executors. It is often dangerous and error-prone to use common pool in Java. Why not remove methods that using common pool to avoid misuse?

Wrong use case Dangerous use of ForkJoinPool

XW512 commented 4 days ago

I think there are two ways to keep it convenient for users who don't have a lot of call volume to use. If they all need to define executors themselves, it would be too cumbersome

oldratlee commented 2 days ago

I saw some methods do not require user to pass executors. It is often dangerous and error-prone to use common pool in Java.

cffu lib supports the best practice and safe usage of executor by new classes:

support the default executor setting for safety(and convenience), and MUST set.


Why not remove methods that using common pool to avoid misuse?

Class CompletableFutureUtils enhances the CompletableFuture and has consistent conventions with CompletableFuture; otherwise it will be too "clever" and surprise as a util class.

Being simple and unadorned is OK and recommended for util class CompletableFutureUtils.

@linzee1 @XW512


Close this issue for the specific cffu design case.

Welcome to continue the discussion of design 💕