1
號演員池中的線程在我的演員之一反應方法I輸出線程池做:限制爲1
val scalaThreadSet = asScalaSet(Thread.getAllStackTraces().keySet());
scalaThreadSet.foreach(element => Console.println("Thread=" + element + ",state=" +
element.getState()))
我看到一堆線程:
Thread=Thread[ForkJoinPool-1-worker-6,5,main],state=WAITING
Thread=Thread[Signal Dispatcher,9,system],state=RUNNABLE
Thread=Thread[ForkJoinPool-1-worker-10,5,main],state=RUNNABLE
Thread=Thread[ForkJoinPool-1-worker-13,5,main],state=WAITING
Thread=Thread[ForkJoinPool-1-worker-7,5,main],state=WAITING
Thread=Thread[ForkJoinPool-1-worker-9,5,main],state=WAITING
Thread=Thread[ForkJoinPool-1-worker-14,5,main],state=WAITING
祝到線程池的大小減少到一個,只看到一個線程,所以我通過:
所以我通過:
-Dactors.maxPoolSize=1
爲VM參數。
我的期望是我現在應該只看到一個線程,但我還是看到負荷。有任何想法嗎?