You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is suitable to keep all CPU's busy with in-memory processing.
805
805
ForI/O, however, this number is typically not suitable because relatively much time is spent waiting for the response and not in CPU.
806
806
This likely exhausts the common pool for some time thereby blocking all other use of the common pool.
807
-
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpo)
807
+
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpool)
808
808
**Solution:**A separate, properly sized, pool of threads (an Executor) should be used for the async calls.
809
809
**Rule name:**AvoidCommonPoolForFutureAsync
810
810
**Example:**
@@ -832,7 +832,7 @@ public class Foo {
832
832
which is suitable to keep all CPU's busy with in-memory processing.
833
833
ForI/O or other blocking calls, however, this number is typically not suitable because relatively much time is spent waiting for the response and not in CPU.
834
834
This likely exhausts the common pool for some time thereby blocking all other use of the common pool.
835
-
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpo)
835
+
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpool)
836
836
**Solution:**A separate, properly sized, pool of threads (an Executor or ForkJoinPool) should be used for the async calls.
837
837
**Rule name:**AvoidCommonPoolForBlockingCalls
838
838
**Example:**
@@ -902,7 +902,7 @@ class AxualProducerGood2{
902
902
It is designed to distribute much CPU work over the cores.
903
903
It is *not* meant for remote calls nor other blocking calls.
904
904
In addition, parallelizing has overhead and risks, should only be used for much pure CPU processing.
905
-
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpo)
905
+
The common pool must *not* be used for blocking calls, see [BeAware of ForkJoinPool#commonPool()](https://dzone.com/articles/be-aware-of-forkjoinpoolcommonpool)
906
906
**Solution:**For remote/blocking calls:Use a dedicated thread pool with enough threads to get proper parallelism independent of the number of cores.
907
907
For pure CPU processing: use ordinary sequential streaming unless the work takes more than about 0,1 ms in sequential form and proves to be faster with parallelization.
908
908
So only for large collections and much processing without having to wait.
0 commit comments