1
1
package spp .demo ;
2
2
3
- import com .codahale .metrics .ConsoleReporter ;
4
- import com .codahale .metrics .MetricRegistry ;
5
- import com .codahale .metrics .Timer ;
6
3
import io .micronaut .runtime .Micronaut ;
7
4
import spp .demo .command .AddBreakpoint ;
8
5
import spp .demo .command .AddLog ;
17
14
public class Main {
18
15
19
16
private static final Executor executor = Executors .newCachedThreadPool ();
20
- private static final MetricRegistry metricRegistry = new MetricRegistry ();
21
17
22
18
public static void main (String [] args ) throws Exception {
23
19
Micronaut .run (Main .class , args );
24
20
25
- ConsoleReporter reporter = ConsoleReporter .forRegistry (metricRegistry ).build ();
26
-
27
21
while (true ) {
28
22
executeDemos ();
29
23
Thread .sleep (1000 );
30
-
31
- reporter .report ();
32
-
33
- int threadCount = Thread .activeCount ();
34
- System .out .println ("Thread count: " + threadCount );
35
24
}
36
25
}
37
26
@@ -90,7 +79,6 @@ public static void triggerEndpoints() {
90
79
}
91
80
92
81
private static void callEndpoint (String endpoint ) {
93
- Timer .Context timer = metricRegistry .timer (endpoint ).time ();
94
82
URL url ;
95
83
try {
96
84
url = new URL ("http://localhost:8080" + endpoint );
@@ -104,14 +92,12 @@ private static void callEndpoint(String endpoint) {
104
92
connection = (HttpURLConnection ) url .openConnection ();
105
93
connection .setConnectTimeout (10_000 );
106
94
connection .setReadTimeout (10_000 );
107
- int responseCode = connection .getResponseCode ();
108
- System .out .println ("Response code: " + responseCode );
95
+ connection .getResponseCode ();
109
96
} catch (Exception ignore ) {
110
97
} finally {
111
98
if (connection != null ) {
112
99
connection .disconnect ();
113
100
}
114
- timer .close ();
115
101
}
116
102
});
117
103
}
0 commit comments