Part of my scala program:
import java.util.concurrent.{ExecutorService, Executors, TimeUnit}
val genericExecutorService = Executors.newCachedThreadPool()
val scheduledExecutorService = Executors.newScheduledThreadPool(4)
val scheduledExecutorService1 = Executors.newScheduledThreadPool(1)
val scheduledExecutorService2 = Executors.newScheduledThreadPool(1)
I counted the number of threads from the log file, and the number is 120. Part of log file:
2018-10-18 00:00:00,421 INFO [pool-7-thread-32] xxx
Count the thread in log file:
$ grep -r "thread" xxx.log | grep -Po '(?<=(\[)).*(?=\])' | sort | uniq -c | wc -l
120
I counted the threads of java by
$ cat /proc/2966/status | grep Threads
Threads: 1524
$ ps -eLF| grep -c java
1525
$ ps -L -o pid= -p 2966 | wc -l
1524
Why 1525
and 120
so different? Any hints welcomed.
Thanks.