Last active
December 10, 2020 16:01
-
-
Save atamborrino/e5f6ce701e0200505f9f647473d4ce9c to your computer and use it in GitHub Desktop.
Serializable Scala ExecutionContext for Spark. Allows to automatically re-create a thread-pool per Spark worker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ECProvider()(implicit conf: Config) extends Serializable { | |
@transient implicit lazy val ec: ExecutionContext = { | |
ExecutionContext.fromExecutorService( | |
Executors.newWorkStealingPool(conf.getForkJoinPoolMaxParallelism()) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment