scala - how to check my akka dispatchers defined in config file working or not -


hi new akka dispatchers took akka documentation

i want check either tuned dispatcher correctly or not here applica.conf

include "directuserwritemongoactor"   akka {    loggers = ["akka.event.slf4j.slf4jlogger"]    loglevel = "debug"  } 

here directuserwritemongoactor.conf

akka {   actor{      ############################### setting dispatcher #####################################                   directuserwritemongoactor-dispatcher {          type = dispatcher     executor = "fork-join-executor"   fork-join-executor {     parallelism-min = 2     parallelism-factor = 2.0     parallelism-max = 10   }   throughput = 10                            } #end default-dispatcher       ############################### setting router #####################################                    deployment{      /directuserwritwmongoactorrouter{      router = round-robin      nr-of-instances = 5      }      }#end deployment     }  #end actor }  #end akka 

and here code

object testactor extends app{        val config = configfactory.load().getconfig("akka.actor")        val system = actorsystem("testactorsystem",config)        val directuserwritemongoactor = system.actorof(props[directuserwritemongoactor].withdispatcher("directuserwritemongoactor-dispatcher"), name = "directwritemongoactor")  class directuserwritemongoactor extends actor { def receive = { case _ =>  } } 

when run code compiles wondering how know whether akka dispatcher working or not please

you can print thread name inside actor, since thread pools (used dispatchers) have proper names should able identify if it's running on dispatcher expected run.

class checkingthread extends actor {   def receive = {      case _ =>        println(s"using thread: ${thread.currentthread().getname}")       // or reply it: sender() ! thread.currentthread().getname    } } 

you can investigate running threads opening visual vm or jvm profiler / have available.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -