JoeMjr2
JoeMjr2

Reputation: 3944

Inspecting Akka dispatcher at runtime

I am working with Akka dispatcher/executor configuration and I would like to prove to myself that the configuration changes that I made took effect. So, I want to inspect the dispatcher's executor parameters (i.e. parallelism-min, parallelism-factor, parallelism-max) at runtime.

I tried this:

println(actorSystem.dispatcher.toString)

However, all it prints out is: Dispatcher[akka.actor.default-dispatcher], without any other details of specific parameters.

Is it possible to print out the runtime configuration of my dispatcher?

Upvotes: 0

Views: 135

Answers (1)

Matthew I.
Matthew I.

Reputation: 1803

you can use:

actorSystem
  .dispatchers
  .lookup("akka.actor.default-dispatcher")
  .configurator
  .config
  .getInt("fork-join-executor.parallelism-max")
actorSystem
  .dispatchers
  .lookup("akka.actor.default-dispatcher")
  .configurator
  .config
  .getInt("fork-join-executor.parallelism-min")
actorSystem
  .dispatchers
  .lookup("akka.actor.default-dispatcher")
  .configurator
  .config
  .getDouble("fork-join-executor.parallelism-factor")

Upvotes: 1

Related Questions