Created
July 6, 2015 11:28
-
-
Save kermitas/9e212b1daf920fbdd1b8 to your computer and use it in GitHub Desktop.
Example of usage low priority threads Akka dispatcher.
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
val lowPriorityThreadsDispatcherName = "low-priority-threads-dispatcher" | |
val lowPriorityThreadsExecutionContext = play.libs.Akka.system.dispatchers.lookup(lowPriorityThreadsDispatcherName) | |
Future { | |
require(Thread.currentThread.getPriority == Thread.MIN_PRIORITY, s"current thread's priority should be ${Thread.MIN_PRIORITY} but it is ${Thread.currentThread.getPriority}") | |
1 + 1 // do something that would be executed on low pririty thread | |
}(lowPriorityThreadsExecutionContext) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment