-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[MINOR][CORE] Replace Scala forkjoin package to Java bundled one #24113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,6 @@ import scala.language.higherKinds | |
| import com.google.common.util.concurrent.{MoreExecutors, ThreadFactoryBuilder} | ||
| import scala.concurrent.{Awaitable, ExecutionContext, ExecutionContextExecutor, Future} | ||
| import scala.concurrent.duration.{Duration, FiniteDuration} | ||
| import scala.concurrent.forkjoin.{ForkJoinPool => SForkJoinPool, ForkJoinWorkerThread => SForkJoinWorkerThread} | ||
| import scala.util.control.NonFatal | ||
|
|
||
| import org.apache.spark.SparkException | ||
|
|
@@ -181,17 +180,17 @@ private[spark] object ThreadUtils { | |
| } | ||
|
|
||
| /** | ||
| * Construct a new Scala ForkJoinPool with a specified max parallelism and name prefix. | ||
| * Construct a new ForkJoinPool with a specified max parallelism and name prefix. | ||
| */ | ||
| def newForkJoinPool(prefix: String, maxThreadNumber: Int): SForkJoinPool = { | ||
| def newForkJoinPool(prefix: String, maxThreadNumber: Int): ForkJoinPool = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this okay for Scala-2.11, too? We still need to support Scala-2.11, don't we? According to SPARK-13398, this was a hack for Scala-2.11 because we can't use Java's ForkJoinPool directly in Scala 2.11 since it uses a ExecutionContext which reports system parallelism. Hi, @holdenk . Could you give us some opinion on this? The old issue is resolved now? Are we safe to revert the old SPARK-13398?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I missed we are still supporting Scala-2.11. It wouldn't even compile for Scala-2.11 because of the parameter type of ForkJoinTaskSupport. Thanks for pointing it out! |
||
| // Custom factory to set thread names | ||
| val factory = new SForkJoinPool.ForkJoinWorkerThreadFactory { | ||
| override def newThread(pool: SForkJoinPool) = | ||
| new SForkJoinWorkerThread(pool) { | ||
| val factory = new ForkJoinPool.ForkJoinWorkerThreadFactory { | ||
| override def newThread(pool: ForkJoinPool) = | ||
| new ForkJoinWorkerThread(pool) { | ||
| setName(prefix + "-" + super.getName) | ||
| } | ||
| } | ||
| new SForkJoinPool(maxThreadNumber, factory, | ||
| new ForkJoinPool(maxThreadNumber, factory, | ||
| null, // handler | ||
| false // asyncMode | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use
ThreadUtils.newForkJoinPoolin this class instead ofForkJoinPooldirectly?