55import spp .demo .command .AddLog ;
66import spp .demo .command .TailLogs ;
77
8+ import java .io .InputStream ;
89import java .net .URL ;
10+ import java .util .Map ;
911import java .util .concurrent .Executor ;
1012import java .util .concurrent .Executors ;
1113
@@ -22,6 +24,16 @@ public static void main(String[] args) throws Exception {
2224
2325 int threadCount = Thread .activeCount ();
2426 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+ }
2537 }
2638 }
2739
@@ -82,9 +94,9 @@ public static void triggerEndpoints() {
8294 private static void callEndpoint (String endpoint ) {
8395 executor .execute (() -> {
8496 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+ }
88100 } catch (Exception ignore ) {
89101 }
90102 });
0 commit comments