O'Reilly logo
  • Iurii Tceretian thinks this is interesting:

Even though the fork/join framework is relatively easy to use, unfortunately it’s also easy to misuse. Here are a few best practices to leverage it effectively:

  • Invoking the join method on a task blocks the caller until the result produced by that task is ready. For this reason, it’s necessary to call it after the computation of both subtasks has been started. Otherwise, you’ll end up with a slower and more complex version of your original sequential algorithm because every subtask will have to wait for the other one to...


Cover of Java 8 in Action: Lambdas, streams, and functional-style programming


Best practices of how to use Fork\Join pool