开发者

Thread monitoring for scala actors

Is there a way to monitor开发者_StackOverflow how many threads are actually alive and running my scala actors ?


The only way to properly do this is to inject your own executor for the actors subsystem as, by default, the actor threads do not have actor- or scala-specific names (they may just be called Thread-N or pool-N-thread-M depending on which version of Scala you are using.

Philip Haller has given instructions on using your own executor, where you can monitor thread usage if you wish, or at the very least name the threads so created. If you override thread naming you could then use the standard Java system MBeans (i.e. ThreadMXBean) to monitor the threads programmatically (or via the JConsole/JVisualVM).

Note that you can control the default mechanism using the system properties:

  • actors.minPoolSize
  • actors.maxPoolSize
  • actors.corePoolSize


You might try the VisualVM tool (available free from Sun). Among other things, it can monitor threads in running JVMs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜