5
5
import spp .demo .command .AddLog ;
6
6
import spp .demo .command .TailLogs ;
7
7
8
- import java .io . InputStream ;
8
+ import java .net . HttpURLConnection ;
9
9
import java .net .URL ;
10
10
import java .util .Map ;
11
11
import java .util .concurrent .Executor ;
@@ -22,9 +22,6 @@ public static void main(String[] args) throws Exception {
22
22
executeDemos ();
23
23
Thread .sleep (1000 );
24
24
25
- int threadCount = Thread .activeCount ();
26
- System .out .println ("Thread count: " + threadCount );
27
-
28
25
Map <Thread , StackTraceElement []> threads = Thread .getAllStackTraces ();
29
26
for (Map .Entry <Thread , StackTraceElement []> entry : threads .entrySet ()) {
30
27
Thread thread = entry .getKey ();
@@ -34,6 +31,9 @@ public static void main(String[] args) throws Exception {
34
31
System .out .println (" " + stackTraceElement );
35
32
}
36
33
}
34
+
35
+ int threadCount = Thread .activeCount ();
36
+ System .out .println ("Thread count: " + threadCount );
37
37
}
38
38
}
39
39
@@ -94,9 +94,12 @@ public static void triggerEndpoints() {
94
94
private static void callEndpoint (String endpoint ) {
95
95
executor .execute (() -> {
96
96
try {
97
- //noinspection EmptyTryBlock
98
- try (InputStream ignore = new URL ("http://localhost:8080" + endpoint ).openStream ()) {
99
- }
97
+ URL url = new URL ("http://localhost:8080" + endpoint );
98
+ HttpURLConnection connection = (HttpURLConnection ) url .openConnection ();
99
+ connection .setConnectTimeout (5000 );
100
+ connection .setReadTimeout (5000 );
101
+ connection .getResponseCode ();
102
+ connection .disconnect ();
100
103
} catch (Exception ignore ) {
101
104
}
102
105
});
0 commit comments