Hello,
I'm trying to configure an ActorSystem, but no matter what I do, seem to be
getting the default dispatcher. Here's what I've got going on:
val customConf = ConfigFactory.parseString(
"""
|akka {
|
| actor{
|
| /function-scheduler {
| dispatcher = function-scheduler-dispatcher
| }
|
| function-scheduler-dispatcher {
| type = Dispatcher
| executor = "fork-join-executor"
| fork-join-executor {
| # Min number of threads
| parallelism-min = 2
| # available processors * factor
| parallelism-factor = 4.0
| # Max number of threads
| parallelism-max = 32
| }
| }
| }
|
|}
""".stripMargin)
val system:ActorSystem =
ActorSystem("function-scheduler",ConfigFactory.load(customConf))
import system.dispatcher
def scheduleOnce(delayTime: Long)(f:() => Unit):Unit = {
import scala.language.postfixOps
system.scheduler.scheduleOnce(delayTime milliseconds) {
f()
}
}
As you can see, what I'm trying to do is use a scheduler to be able to
schedule arbitrary tasks. The problem is that everything I've tried in that
customConf still results in system using the akka.actor.default-dispatcher.
I definitely don't understand how the configuration stuff works, but my
theory is that I'm configuring the dispatcher that would be used for
created ActorRefs if I was to call something like:
val myActor =
system.actorOf(Props[MyActor].withDispatcher("function-scheduler-dispatcher"),
"myactor1")
rather than configuring the system itself.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.