2
有什麼方法可以在Scala或Play Framework中獲取線程池指標?Scala/Play線程池指標
在scala.concurrent我只能訪問
ExecutionContextExecutor
它沒有返回的活動連接的方法,排隊任務數等
我不能投它即有機會獲得的實現執行者,因爲他們是私人的。
謝謝你的幫助。
有什麼方法可以在Scala或Play Framework中獲取線程池指標?Scala/Play線程池指標
在scala.concurrent我只能訪問
ExecutionContextExecutor
它沒有返回的活動連接的方法,排隊任務數等
我不能投它即有機會獲得的實現執行者,因爲他們是私人的。
謝謝你的幫助。
我解決了這樣的說法:
val field: Field = Class.forName("scala.concurrent.impl.ExecutionContextImpl").getDeclaredField("executor")
field.setAccessible(true)
val executor: ForkJoinPool = field.get(ExecutionContext.global).asInstanceOf[ForkJoinPool]
我知道,它僅適用於ForkJoinPool的時刻,但使用一些模式匹配等,它可以更通用的,與工作ThreadPoolExecutor。