Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which threads run a parallel stream - which of the following is true?

  • A.A parallel stream runs on a single background thread.
  • B.A parallel stream runs on the thread that started it, interleaving the stages.
  • C.A parallel stream uses the common ForkJoinPool.
  • D.A parallel stream creates a private thread pool sized to the stream's length.

Answer: C

Unless a task is submitted to a pool of your own, parallel streams draw on the common ForkJoinPool, which is shared process-wide. A long or blocking operation inside one therefore delays unrelated parallel work, which is why blocking calls do not belong in a parallel stream.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.