Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11423#discussion_r54387309
  
    --- Diff: core/src/main/scala/org/apache/spark/util/ThreadUtils.scala ---
    @@ -156,4 +156,30 @@ private[spark] object ThreadUtils {
             result
         }
       }
    +
    +  /**
    +   * Construct a new Java ForkJoinPool with a specified max parallelism 
and name prefix.
    +   */
    +  def newForkJoinPool(prefix: String, maxThreadNumber: Int): ForkJoinPool 
= {
    +    /**
    +     * Extend ForkJoinWorkerThread so we can instantiate it.
    +     */
    +    class SparkForkJoinWorkerThread(pool: ForkJoinPool) extends 
ForkJoinWorkerThread(pool) {
    --- End diff --
    
    Comments are great of course -- javadoc won't do anything here. It could be 
a line comment.
    
    I think you might be able to collapse most of this with anonymous classes:
    
    ```
        val factory = new ForkJoinWorkerThreadFactory {
          override def newThread(pool: ForkJoinPool) =
            new ForkJoinWorkerThread(pool) {
              setName(prefix + "-" + super.getName)
            }
        }
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to