Java线程getID()的困惑
2016-12-11
~~~~~~~~
额。。那为什么是从10开始啊?它不是随机的呀。。
MAC 笔记本中 IDEA 创建线程宽嫌老输出 thread.getId() 为12
threadId:11,threadName:Service Thread
threadId:10,threadName:C1 CompilerThread2
threadId:9,threadName:C2 CompilerThread1
threadId:8,threadName:C2 CompilerThread0 C2 Compiler 是JVM在server模式下字节码者燃编译器慎升
threadId:7,threadName:JDWP Command Reader
threadId:6,threadName:JDWP Event Helper Thread
threadId:5,threadName:JDWP Transport Listener: dt_socket
threadId:4,threadName:Signal Dispatcher
threadId:3,threadName:Finalizer
threadId:2,threadName:Reference Handler
threadId:1,threadName:main
其中
编号 1 ~ 8 ,参考:网页链接
编号 9 ~ 11 ,debug 跟踪记录 Thread 源码中 init 方法的 name 值