scala.concurrent.forkjoin.ForkJoinPool vs java.util.concurrent.ForkJoinPool
Asked Answered
R

1

10

Why ForkJoinPool was forked for Scala?

Which implementation and for which case is preferred?

Ragsdale answered 28/1, 2013 at 12:29 Comment(0)
A
16

The obvious reason for the scala library to have its own copy of ForkJoinPool is that scala must run on pre-1.7 JVMs, and ForkJoinPool was only introduced in Java 1.7.

In addition, there were a few changes made for internal (scala) use, such as this:

https://github.com/scala/scala/commit/76e9da2ca4c31daec2b04848c3c2dbad6ecd426e

Given that scala's version will probably not give you any advantage (if you are compiling and running against java 1.7), I'd say that for you own use you should probably use java's version. At least java's version is precisely documented and fully "public", while the status of scala's version is unclear (it might very well be intended for internal use only). However in some places you might not have any choice. By example ForkJoinTasks has a forkJoinPool method that expects scala's version of ForkJoinPool. If someone can get/find any official status for scala's version of ForkJoinPool stating that it's really public and stable, then I'll happily revert this advice.

Agenesis answered 28/1, 2013 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.