【Java并发 02】Thread由浅入深

知识储备

Java中的线程类Thread是从1.0开始便提供给使用者的工具,用于并行计算。

线程特点

Thread有如下特点:

  1. 线程的创建主要通过Thread(Runnable target)进行创建

  2. 每个线程具有优先级,高优先级的线程会比低优先级的线程;

  3. 线程主要分为Daemon线程的非Daemon线程(也叫User线程)两类;

    • 线程的Daemon属性可以通过setDaemonisDaemon两个接口修改和查询
    • 一旦线程开始运行(执行start),就不再允许修改Daemon标志位;
    • 一旦所有的非Daemon线程均结束,JVM将会停止;
    • Daemon线程创建的子线程都默认为Daemon,非Daemon线程创建的线程默认都是非Daemon,但是所有线程,不管被谁创建,都可以在启动之前修改自己是否是Daemon线程的属性;
  4. 每一个线程除了拥有自己的线程名、优先级、Daemon等属性之外,其实还拥有自己的ThreadGroup信息

    • ThreadGroup是一组Thread的集合,可以在这个集合里面统一的管理所有的线程
    • 如果一个线程通过不带ThreadGroup的构造函数创建,或者通过传入一个null的ThreadGroup作为入参的构造函数创建的话,该线程将默认继承其父线程的ThreadGroup信息。
  5. JVM中的线程是树状关系

    • 两个不同的线程可以拥有一个共同的祖先,但是两个不同的线程不可以拥有一个共同的子孙
    • 在整颗树形节点中,每一个节点既可以是线程,也可以是线程组;
    • 这颗树状关系的根节点是system线程组
    • JVM启动之后,主线程会创建一个默认的线程组main,也就意味着,所有用户创建的非Daemon线程,均会被默认划分在main线程组中
    • 可以在程序运行时断定,然后执行Thread.currentThread().getThreadGroup()找到当前线程所属的线程组,并不断通过ThreadGroup#getParent()获取父线程组。(注,Thread不支持直接查找父线程,ThreadGroup只能查找自己的父线程组)
  6. Java的线程提供了类似Posix Thread标准的线程操作接口:

    • Thread currentThread(); // 获取当前线程的引用
    • void yield(); // 线程让步(暂时放弃CPU资源,让线程重新回到RUNNABLE状态,不接受中断)
    • void sleep(long millis) throws InterruptedException; // 线程休眠
    • void start(); // 线程实际创建函数
      • start后会实际执行native方法start0
      • 线程在整个生命周期内只能执行一次start(之后会讲解线程池是如何避开这个约束的)
    • void join(final long millis) throws InterruptedException; // 阻塞主线程,等待子线程任务执行完毕
      • 注意,如果join在start之前被执行,则父线程仅仅只是等到当前子线程执行完毕才会被回收,但是不会阻塞父线程的任务执行;
      • 如果join在start之后被执行,则父线程会被阻塞,直到当前线程的任务全部执行完成,才能够继续执行join之后的任务。
      • millis为0表示父线程会被一直阻塞直到子线程完成;millis为正数表示父线程会等待millis毫秒,如果子线程在规定时间内完成或者超时,父线程均会停止等待;
      • join(long millis, int nanos)这个函数中,nanos其实不会真的被进行计时,而是会被换算成millis然后向上取整(是的,你没看错,JDK在这里耍赖了,我这里参考的源码时Oracle JDK 15)

操作系统的线程状态转换

在查看Java的线程状态转换之前,首先回顾一下经典的操作系统的线程状态转换

操作系统线程状态

  1. new为线程的新生状态,创建后的初始状态即为此状态,此时线程既没有CPU资源也没有内存资源;
  2. ready为线程的就绪状态,此时线程在就绪队列中等待被执行,线程提交之后转变成该状态,此时线程持有自己的内存资源,等待操作系统的调度器sheduler分配CPU资源;
  3. running为线程的运行状态,此时线程从错做系统的调度器sheduler获取了CPU资源,开始进行自己的线程计算动作,此状态下,可能会受到时钟中断的影响(比如时间片耗尽),OS会挂起当前线程,重新转换回ready状态;
  4. waiting为线程的等待状态,通常会有三种情况触发线程转换成该状态:
    1. 此时线程通常会触发CPU的一个陷阱(trap)导致用户态线程被挂起,等待trap所触发的内核态进程返回结果,这个结果通常在内核态进程发出中断(interrupt)之后,唤醒用户态线程从而才能获取到。而触发trap之后等待interrupt的线程状态,就是waiting状态。waiting状态的线程被唤醒之后,将获取到的结果寄存到自己的栈空间中,让在就绪队列等待CPU资源从而进行消费;
    2. 向操作系统获取临界资源失败后,等待临界资源释放;
    3. 等待其他任务到达(join)
  5. terminated为线程的终止状态,此时线程可能执行完了自己所有的任务,随之走向终止;也可能线程自行强行终止;也可能被操作系统强行回收等等。

Java线程状态转换

与操作系统类似的,Java线程提供了6个状态,位于java.lang.Thread.State,用于线程状态的管理和状态转换:

  • NEW
    • 对应操作系统的线程状态中的new状态
    • 线程创建完成之后,还没执行start方法之前的状态
    • 此时线程实际上还没有开始在OS中申请资源,也没有进行栈分配,也即jstack查看的消息中,栈地址是0x0000000000000000
    • 此时JDK中的线程检查工具包无法监控当前线程的信息
    • 标志位存在java.lang.Thread#threadStatus的第1位(最低位)
  • RUNNABLE
    • 对应操作系统的running状态,表示一个线程正在运行
    • 或者对应操作系统的ready状态,表示一个线程可以被运行,仅仅只是缺少CPU资源
    • 此状态通常为Thread已经调用的start0这个native方法之后的状态,或者阻塞终止之后,继续运行的状态
    • 此时线程会持有自己的栈空间(不管是ready还是running)
    • 标志位存在java.lang.Thread#threadStatus的第3位
  • BLOCKED
    • 对应操作系统的waiting状态,表示线程长在等待获取一把互斥锁
    • 此状态通常为线程在等待monitor lock时,因为获取不到而被阻塞;等待monitor lock的典型场景为:
      1. synchronized方法或者代码块的开始,未获取到monitor lock从而导致BLOCKED
      2. lock.wait结束之后,和其他线程争抢monitor lock时未获取到导致自己被BLOCKED
  • WAITING
    • 同样对应操作系统的waiting状态,表示线程正在等待另一个线程执行完成(和BLOCKED目的不一样)
    • 此状态通常为线程在synchronized代码块中,被锁对象执行lock.wait()暂停;此时线程会放弃原本被synchronized代码块锁住的锁对象。
    • 或者当前线程被子线程join,也会造成当前父线程WAITING,等待子线程完成并唤醒;
    • 或者当前线程使用LockSupport.park()进行暂停;(parking可以被thread.interrupt()LockSupport.unpark(thread)重新唤醒)
  • TIMED_WAITING
    • 同样对应操作系统的waiting状态,表示线程此时正在等待一个时间中断被唤醒
    • 此状态通常为Thread在规定时间内等待互斥锁,常见的操作为
      1. Thread.sleep();
      2. Object.wait()一段时间,非0;(注:Java中没有真实计算纳秒,而是向上取整换算成了毫秒进行的计算)
      3. Thread.join(),入参非0;(注:Java中没有真实计算纳秒,而是向上取整换算成了毫秒进行的计算)
      4. LockSupport.parkNanos,暂停非0ns的时间;
      5. LockSupport.parkUntil,暂停至某一个目的时间;
  • TERMINATED
    • 线程结束后的状态

线程状态变换

下图是一个我目前为止找到的比较好的线程状态示意图:
Protocol state machine example - Thread states and life cycle in Java.

Jstack捕获的Thread信息

下图为一个测试demo随机捕获的栈信息,可以试着使用上述内容进行分析。

"Monitor Ctrl-Break" #21 daemon prio=5 os_prio=0 cpu=31.25ms elapsed=0.80s tid=0x0000019ead781240 nid=0x2ab4 runnable  [0x000000830d6fe000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.SocketDispatcher.read0(java.base@15.0.1/Native Method)
	at sun.nio.ch.SocketDispatcher.read(java.base@15.0.1/SocketDispatcher.java:46)
	at sun.nio.ch.NioSocketImpl.tryRead(java.base@15.0.1/NioSocketImpl.java:261)
	at sun.nio.ch.NioSocketImpl.implRead(java.base@15.0.1/NioSocketImpl.java:312)
	at sun.nio.ch.NioSocketImpl.read(java.base@15.0.1/NioSocketImpl.java:350)
	at sun.nio.ch.NioSocketImpl$1.read(java.base@15.0.1/NioSocketImpl.java:803)
	at java.net.Socket$SocketInputStream.read(java.base@15.0.1/Socket.java:981)
	at sun.nio.cs.StreamDecoder.readBytes(java.base@15.0.1/StreamDecoder.java:297)
	at sun.nio.cs.StreamDecoder.implRead(java.base@15.0.1/StreamDecoder.java:339)
	at sun.nio.cs.StreamDecoder.read(java.base@15.0.1/StreamDecoder.java:188)
	- locked <0x000000071941d1d0> (a java.io.InputStreamReader)
	at java.io.InputStreamReader.read(java.base@15.0.1/InputStreamReader.java:181)
	at java.io.BufferedReader.fill(java.base@15.0.1/BufferedReader.java:161)
	at java.io.BufferedReader.readLine(java.base@15.0.1/BufferedReader.java:326)
	- locked <0x000000071941d1d0> (a java.io.InputStreamReader)
	at java.io.BufferedReader.readLine(java.base@15.0.1/BufferedReader.java:392)
	at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:47)


"Thread-2" #25 daemon prio=5 os_prio=0 cpu=109.38ms elapsed=0.79s tid=0x0000019ead85b8c0 nid=0xa70 runnable  [0x000000830dcfe000]
   java.lang.Thread.State: RUNNABLE
	at java.io.PrintStream.write(java.base@15.0.1/PrintStream.java:566)
	- locked <0x0000000719649010> (a java.io.PrintStream)
	at sun.nio.cs.StreamEncoder.writeBytes(java.base@15.0.1/StreamEncoder.java:242)
	at sun.nio.cs.StreamEncoder.implFlushBuffer(java.base@15.0.1/StreamEncoder.java:321)
	at sun.nio.cs.StreamEncoder.flushBuffer(java.base@15.0.1/StreamEncoder.java:110)
	- locked <0x0000000719649320> (a java.io.OutputStreamWriter)
	at java.io.OutputStreamWriter.flushBuffer(java.base@15.0.1/OutputStreamWriter.java:181)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:723)
	- locked <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Common-Cleaner" #20 daemon prio=8 os_prio=1 cpu=0.00ms elapsed=0.85s tid=0x0000019ead6d5430 nid=0xf38 in Object.wait()  [0x000000830d2fe000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(java.base@15.0.1/Native Method)
	- waiting on <0x00000007196b3a00> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@15.0.1/ReferenceQueue.java:155)
	- locked <0x00000007196b3a00> (a java.lang.ref.ReferenceQueue$Lock)
	at jdk.internal.ref.CleanerImpl.run(java.base@15.0.1/CleanerImpl.java:148)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)
	at jdk.internal.misc.InnocuousThread.run(java.base@15.0.1/InnocuousThread.java:134)


"main" #1 prio=5 os_prio=0 cpu=109.38ms elapsed=0.91s tid=0x0000019e87110a30 nid=0x2a94 in Object.wait()  [0x000000830c3ff000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@15.0.1/Native Method)
	- waiting on <0x000000071947ac90> (a java.lang.Thread)
	at java.lang.Thread.join(java.base@15.0.1/Thread.java:1303)
	- locked <0x000000071947ac90> (a java.lang.Thread)
	at java.lang.Thread.join(java.base@15.0.1/Thread.java:1371)
	at concurrent.Main.main(Main.java:42)


"Thread-0" #23 prio=5 os_prio=0 cpu=31.25ms elapsed=0.79s tid=0x0000019ead85af20 nid=0x2564 waiting for monitor entry  [0x000000830daff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-1" #24 prio=5 os_prio=0 cpu=93.75ms elapsed=0.79s tid=0x0000019ead85b3f0 nid=0x2b64 waiting for monitor entry  [0x000000830dbff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-3" #26 daemon prio=5 os_prio=0 cpu=31.25ms elapsed=0.79s tid=0x0000019ead85c210 nid=0x1a0c waiting for monitor entry  [0x000000830ddff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-4" #27 prio=5 os_prio=0 cpu=78.12ms elapsed=0.79s tid=0x0000019ead860b70 nid=0x433c waiting for monitor entry  [0x000000830deff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-5" #28 prio=5 os_prio=0 cpu=31.25ms elapsed=0.79s tid=0x0000019ead861040 nid=0x2d84 waiting for monitor entry  [0x000000830dfff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-6" #29 prio=5 os_prio=0 cpu=62.50ms elapsed=0.79s tid=0x0000019ead861f00 nid=0x690 waiting for monitor entry  [0x000000830e0ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Thread-7" #30 prio=5 os_prio=0 cpu=78.12ms elapsed=0.79s tid=0x0000019ead864580 nid=0x2a40 waiting for monitor entry  [0x000000830e1ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$1(Main.java:22)
	at concurrent.Main$$Lambda$14/0x0000000800bb1240.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-2" #35 prio=5 os_prio=0 cpu=62.50ms elapsed=0.78s tid=0x0000019ead863be0 nid=0x340c waiting for monitor entry  [0x000000830d9fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-6" #36 prio=5 os_prio=0 cpu=46.88ms elapsed=0.78s tid=0x0000019ead8628a0 nid=0x3c48 waiting for monitor entry  [0x000000830e2fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-4" #39 prio=5 os_prio=0 cpu=46.88ms elapsed=0.78s tid=0x0000019ead861a30 nid=0x1c40 waiting for monitor entry  [0x000000830e3ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-5" #32 prio=5 os_prio=0 cpu=156.25ms elapsed=0.78s tid=0x0000019ead8640b0 nid=0xc4 waiting for monitor entry  [0x000000830e4ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-1" #34 prio=5 os_prio=0 cpu=62.50ms elapsed=0.78s tid=0x0000019ead863240 nid=0xcd4 waiting for monitor entry  [0x000000830e5fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-3" #33 prio=5 os_prio=0 cpu=31.25ms elapsed=0.78s tid=0x0000019ead861560 nid=0x47fc waiting for monitor entry  [0x000000830e6fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-7" #37 prio=5 os_prio=0 cpu=31.25ms elapsed=0.78s tid=0x0000019ead8623d0 nid=0x714 waiting for monitor entry  [0x000000830e7fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"subThread-0" #38 prio=5 os_prio=0 cpu=109.38ms elapsed=0.78s tid=0x0000019ead862d70 nid=0x3b4 waiting for monitor entry  [0x000000830e8fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.PrintStream.writeln(java.base@15.0.1/PrintStream.java:718)
	- waiting to lock <0x0000000719649010> (a java.io.PrintStream)
	at java.io.PrintStream.println(java.base@15.0.1/PrintStream.java:1028)
	at concurrent.Main.lambda$main$0(Main.java:12)
	at concurrent.Main$$Lambda$17/0x0000000800bb1460.run(Unknown Source)
	at java.lang.Thread.run(java.base@15.0.1/Thread.java:832)


"Reference Handler" #2 daemon prio=10 os_prio=2 cpu=0.00ms elapsed=0.89s tid=0x0000019eacd9e4e0 nid=0xd34 waiting on condition  [0x000000830caff000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.ref.Reference.waitForReferencePendingList(java.base@15.0.1/Native Method)
	at java.lang.ref.Reference.processPendingReferences(java.base@15.0.1/Reference.java:241)
	at java.lang.ref.Reference$ReferenceHandler.run(java.base@15.0.1/Reference.java:213)


"Finalizer" #3 daemon prio=8 os_prio=1 cpu=0.00ms elapsed=0.89s tid=0x0000019ead5a2090 nid=0xd14 in Object.wait()  [0x000000830cbff000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@15.0.1/Native Method)
	- waiting on <0x000000071960c6d8> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@15.0.1/ReferenceQueue.java:155)
	- locked <0x000000071960c6d8> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@15.0.1/ReferenceQueue.java:176)
	at java.lang.ref.Finalizer$FinalizerThread.run(java.base@15.0.1/Finalizer.java:170)


"Signal Dispatcher" #4 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=0.87s tid=0x0000019ead5c4750 nid=0x36c0 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE


"Attach Listener" #5 daemon prio=5 os_prio=2 cpu=0.00ms elapsed=0.87s tid=0x0000019ead5c7020 nid=0x1424 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE


"Service Thread" #6 daemon prio=9 os_prio=0 cpu=0.00ms elapsed=0.87s tid=0x0000019ead5c88f0 nid=0x1f0c runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE


"C2 CompilerThread0" #7 daemon prio=9 os_prio=2 cpu=109.38ms elapsed=0.87s tid=0x0000019ead5c94e0 nid=0x46ec waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"C1 CompilerThread0" #15 daemon prio=9 os_prio=2 cpu=46.88ms elapsed=0.87s tid=0x0000019ead5cd390 nid=0x3ce0 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"Sweeper thread" #19 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=0.87s tid=0x0000019ead5ceca0 nid=0x1c0c runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE


"C1 CompilerThread1" #16 daemon prio=9 os_prio=2 cpu=15.62ms elapsed=0.84s tid=0x0000019ead6da1b0 nid=0x215c waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"C1 CompilerThread2" #17 daemon prio=9 os_prio=2 cpu=15.62ms elapsed=0.84s tid=0x0000019ead6dc780 nid=0x47c0 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"C2 CompilerThread1" #8 daemon prio=9 os_prio=2 cpu=46.88ms elapsed=0.83s tid=0x0000019ead7466a0 nid=0x16f4 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"Notification Thread" #22 daemon prio=9 os_prio=0 cpu=0.00ms elapsed=0.80s tid=0x0000019ead781710 nid=0x3fe0 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE


"C1 CompilerThread3" #18 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=0.76s tid=0x0000019eadc19220 nid=0x150 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"C2 CompilerThread2" #9 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=0.67s tid=0x0000019eadc14360 nid=0x2804 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task


"VM Thread" os_prio=2 cpu=15.62ms elapsed=0.89s tid=0x0000019eacd9ce50 nid=0x4534 runnable  


"GC Thread#0" os_prio=2 cpu=0.00ms elapsed=0.90s tid=0x0000019e871614d0 nid=0x674 runnable  


"G1 Main Marker" os_prio=2 cpu=0.00ms elapsed=0.90s tid=0x0000019e87172b90 nid=0x15e8 runnable  


"G1 Conc#0" os_prio=2 cpu=0.00ms elapsed=0.90s tid=0x0000019e87173610 nid=0x34b4 runnable  


"G1 Refine#0" os_prio=2 cpu=0.00ms elapsed=0.90s tid=0x0000019e871e0810 nid=0x38a0 runnable  


"G1 Young RemSet Sampling" os_prio=2 cpu=0.00ms elapsed=0.90s tid=0x0000019e871e12a0 nid=0x35fc runnable  


"VM Periodic Task Thread" os_prio=2 cpu=0.00ms elapsed=0.79s tid=0x0000019ead8506d0 nid=0x1c24 waiting on condition  
JNI global refs: 23, weak refs: 0

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页