Created
November 12, 2019 00:55
-
-
Save justinhj/f2dcb243fba709a4a8af9582d87f1a3e to your computer and use it in GitHub Desktop.
Custom Scala execution context
This file contains hidden or 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
// Create a custom threadpool and execution context for Akka to use | |
val executor: ExecutorService = Executors.newFixedThreadPool(4, new ThreadFactory() { | |
override def newThread(r: Runnable): Thread = { | |
val t = Executors.defaultThreadFactory.newThread(r) | |
t.setDaemon(true) | |
t | |
} | |
}) | |
implicit val akkaEc: ExecutionContext = ExecutionContext.fromExecutor(executor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment