Skip to content

Commit 2dcdfaa

Browse files
committed
✨ Introducing new features. thread state
1 parent 2aa2c56 commit 2dcdfaa

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed

79884.log

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2018-03-06 23:11:05
2+
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode):
3+
4+
"Attach Listener" #15 daemon prio=9 os_prio=31 tid=0x00007ffd7b08b800 nid=0x1407 waiting on condition [0x0000000000000000]
5+
java.lang.Thread.State: RUNNABLE
6+
7+
"DestroyJavaVM" #14 prio=5 os_prio=31 tid=0x00007ffd7b001800 nid=0x1c03 waiting on condition [0x0000000000000000]
8+
java.lang.Thread.State: RUNNABLE
9+
10+
"Blocked2" #13 prio=5 os_prio=31 tid=0x00007ffd7b08b000 nid=0x5503 waiting for monitor entry [0x00007000083d1000]
11+
java.lang.Thread.State: BLOCKED (on object monitor)
12+
at com.crossoverjie.concurrent.ThreadState$Blocked.run(ThreadState.java:59)
13+
- waiting to lock <0x000000079576cd60> (a java.lang.Class for com.crossoverjie.concurrent.ThreadState$Blocked)
14+
at java.lang.Thread.run(Thread.java:748)
15+
16+
"Blocked1" #12 prio=5 os_prio=31 tid=0x00007ffd7b08a000 nid=0x5303 waiting on condition [0x00007000082ce000]
17+
java.lang.Thread.State: TIMED_WAITING (sleeping)
18+
at java.lang.Thread.sleep(Native Method)
19+
at com.crossoverjie.concurrent.ThreadState$Blocked.run(ThreadState.java:59)
20+
- locked <0x000000079576cd60> (a java.lang.Class for com.crossoverjie.concurrent.ThreadState$Blocked)
21+
at java.lang.Thread.run(Thread.java:748)
22+
23+
"Waiting" #11 prio=5 os_prio=31 tid=0x00007ffd7b089800 nid=0x5103 in Object.wait() [0x00007000081cb000]
24+
java.lang.Thread.State: WAITING (on object monitor)
25+
at java.lang.Object.wait(Native Method)
26+
- waiting on <0x0000000795768db0> (a java.lang.Class for com.crossoverjie.concurrent.ThreadState$Waiting)
27+
at java.lang.Object.wait(Object.java:502)
28+
at com.crossoverjie.concurrent.ThreadState$Waiting.run(ThreadState.java:42)
29+
- locked <0x0000000795768db0> (a java.lang.Class for com.crossoverjie.concurrent.ThreadState$Waiting)
30+
at java.lang.Thread.run(Thread.java:748)
31+
32+
"TimeWaiting" #10 prio=5 os_prio=31 tid=0x00007ffd7b82c800 nid=0x4f03 waiting on condition [0x00007000080c8000]
33+
java.lang.Thread.State: TIMED_WAITING (sleeping)
34+
at java.lang.Thread.sleep(Native Method)
35+
at com.crossoverjie.concurrent.ThreadState$TimeWaiting.run(ThreadState.java:27)
36+
at java.lang.Thread.run(Thread.java:748)
37+
38+
"Monitor Ctrl-Break" #9 daemon prio=5 os_prio=31 tid=0x00007ffd7a97e000 nid=0x4d03 runnable [0x0000700007fc5000]
39+
java.lang.Thread.State: RUNNABLE
40+
at java.net.PlainSocketImpl.socketAccept(Native Method)
41+
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
42+
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
43+
at java.net.ServerSocket.accept(ServerSocket.java:513)
44+
at com.intellij.rt.execution.application.AppMain$1.run(AppMain.java:79)
45+
at java.lang.Thread.run(Thread.java:748)
46+
47+
"Service Thread" #8 daemon prio=9 os_prio=31 tid=0x00007ffd7a837800 nid=0x4903 runnable [0x0000000000000000]
48+
java.lang.Thread.State: RUNNABLE
49+
50+
"C1 CompilerThread2" #7 daemon prio=9 os_prio=31 tid=0x00007ffd7b030800 nid=0x4703 waiting on condition [0x0000000000000000]
51+
java.lang.Thread.State: RUNNABLE
52+
53+
"C2 CompilerThread1" #6 daemon prio=9 os_prio=31 tid=0x00007ffd7b029800 nid=0x4503 waiting on condition [0x0000000000000000]
54+
java.lang.Thread.State: RUNNABLE
55+
56+
"C2 CompilerThread0" #5 daemon prio=9 os_prio=31 tid=0x00007ffd7a813800 nid=0x4303 waiting on condition [0x0000000000000000]
57+
java.lang.Thread.State: RUNNABLE
58+
59+
"Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007ffd7a839000 nid=0x4103 runnable [0x0000000000000000]
60+
java.lang.Thread.State: RUNNABLE
61+
62+
"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007ffd7b00b800 nid=0x3103 in Object.wait() [0x00007000078b0000]
63+
java.lang.Thread.State: WAITING (on object monitor)
64+
at java.lang.Object.wait(Native Method)
65+
- waiting on <0x0000000795588ec8> (a java.lang.ref.ReferenceQueue$Lock)
66+
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
67+
- locked <0x0000000795588ec8> (a java.lang.ref.ReferenceQueue$Lock)
68+
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
69+
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
70+
71+
"Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007ffd7a800800 nid=0x2f03 in Object.wait() [0x00007000077ad000]
72+
java.lang.Thread.State: WAITING (on object monitor)
73+
at java.lang.Object.wait(Native Method)
74+
- waiting on <0x0000000795586b68> (a java.lang.ref.Reference$Lock)
75+
at java.lang.Object.wait(Object.java:502)
76+
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
77+
- locked <0x0000000795586b68> (a java.lang.ref.Reference$Lock)
78+
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
79+
80+
"VM Thread" os_prio=31 tid=0x00007ffd7a01a800 nid=0x2d03 runnable
81+
82+
"GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007ffd7b005800 nid=0x2503 runnable
83+
84+
"GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007ffd7b006000 nid=0x2703 runnable
85+
86+
"GC task thread#2 (ParallelGC)" os_prio=31 tid=0x00007ffd7b006800 nid=0x2903 runnable
87+
88+
"GC task thread#3 (ParallelGC)" os_prio=31 tid=0x00007ffd7b808000 nid=0x2b03 runnable
89+
90+
"VM Periodic Task Thread" os_prio=31 tid=0x00007ffd7a03e000 nid=0x4b03 waiting on condition
91+
92+
JNI global references: 21
93+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.crossoverjie.concurrent;
2+
3+
import com.crossoverjie.classloader.Main;
4+
5+
/**
6+
* Function: 线程状态测试
7+
*
8+
* @author crossoverJie
9+
* Date: 06/03/2018 22:56
10+
* @since JDK 1.8
11+
*/
12+
public class ThreadState {
13+
14+
public static void main(String[] args) {
15+
new Thread(new TimeWaiting(),"TimeWaiting").start();
16+
new Thread(new Waiting(),"Waiting").start();
17+
new Thread(new Blocked(),"Blocked1").start();
18+
new Thread(new Blocked(),"Blocked2").start();
19+
}
20+
21+
static class TimeWaiting implements Runnable{
22+
23+
@Override
24+
public void run() {
25+
while (true){
26+
try {
27+
Thread.sleep(1000);
28+
} catch (InterruptedException e) {
29+
e.printStackTrace();
30+
}
31+
}
32+
}
33+
}
34+
35+
static class Waiting implements Runnable{
36+
37+
@Override
38+
public void run() {
39+
while (true){
40+
synchronized (Waiting.class){
41+
try {
42+
Waiting.class.wait();
43+
} catch (InterruptedException e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
}
48+
}
49+
}
50+
51+
52+
static class Blocked implements Runnable{
53+
54+
@Override
55+
public void run() {
56+
while (true){
57+
synchronized (Blocked.class){
58+
try {
59+
Thread.sleep(1000);
60+
} catch (InterruptedException e) {
61+
e.printStackTrace();
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)