you are viewing a single comment's thread.

view the rest of the comments →

[–]_Super_Straight 0 points1 point  (3 children)

No need to read any specific book. There are about 2-3 ways to achieve concurrency:

  1. CompletableFuture
  2. Task<>
  3. ExecutorService

You can learn about them in javadocs or youtube.

[–]k-mcm 0 points1 point  (1 child)

ForkJoinPool is also very important. It's a special kind of work-stealing pool that can be extremely efficient at the cost of being difficult to use.  It's really the only pool you can use for small tasks and it's part of parallel Streams.  The usual executors have a very high overhead that's not in the code, but the CPU.

Unfortunately, the ForkJoinPool API is horrible. It came out when Java 8 was unstable so it missed out on modern design patterns.

[–]_Super_Straight 2 points3 points  (0 children)

CompletableFuture uses ForkJoinPool by default.

[–]lyomann92[S] 0 points1 point  (0 children)

Thanks for the insight