5
5
import spp .demo .command .AddLog ;
6
6
import spp .demo .command .TailLogs ;
7
7
8
+ import java .io .InputStream ;
8
9
import java .net .URL ;
10
+ import java .util .Map ;
9
11
import java .util .concurrent .Executor ;
10
12
import java .util .concurrent .Executors ;
11
13
@@ -22,6 +24,16 @@ public static void main(String[] args) throws Exception {
22
24
23
25
int threadCount = Thread .activeCount ();
24
26
System .out .println ("Thread count: " + threadCount );
27
+
28
+ Map <Thread , StackTraceElement []> threads = Thread .getAllStackTraces ();
29
+ for (Map .Entry <Thread , StackTraceElement []> entry : threads .entrySet ()) {
30
+ Thread thread = entry .getKey ();
31
+ StackTraceElement [] stackTraceElements = entry .getValue ();
32
+ System .out .println ("Thread: " + thread .getName ());
33
+ for (StackTraceElement stackTraceElement : stackTraceElements ) {
34
+ System .out .println (" " + stackTraceElement );
35
+ }
36
+ }
25
37
}
26
38
}
27
39
@@ -82,9 +94,9 @@ public static void triggerEndpoints() {
82
94
private static void callEndpoint (String endpoint ) {
83
95
executor .execute (() -> {
84
96
try {
85
- System . out . println ( "Calling endpoint: " + endpoint );
86
- new URL ("http://localhost:8080" + endpoint ).openStream (). close ();
87
- System . out . println ( "Called endpoint: " + endpoint );
97
+ //noinspection EmptyTryBlock
98
+ try ( InputStream ignore = new URL ("http://localhost:8080" + endpoint ).openStream ()) {
99
+ }
88
100
} catch (Exception ignore ) {
89
101
}
90
102
});
0 commit comments