11package spp .demo ;
22
3- import com .codahale .metrics .ConsoleReporter ;
4- import com .codahale .metrics .MetricRegistry ;
5- import com .codahale .metrics .Timer ;
63import io .micronaut .runtime .Micronaut ;
74import spp .demo .command .AddBreakpoint ;
85import spp .demo .command .AddLog ;
1714public class Main {
1815
1916 private static final Executor executor = Executors .newCachedThreadPool ();
20- private static final MetricRegistry metricRegistry = new MetricRegistry ();
2117
2218 public static void main (String [] args ) throws Exception {
2319 Micronaut .run (Main .class , args );
2420
25- ConsoleReporter reporter = ConsoleReporter .forRegistry (metricRegistry ).build ();
26- 2721 while (true ) {
2822 executeDemos ();
2923 Thread .sleep (1000 );
30- 31- reporter .report ();
32- 33- int threadCount = Thread .activeCount ();
34- System .out .println ("Thread count: " + threadCount );
3524 }
3625 }
3726
@@ -90,7 +79,6 @@ public static void triggerEndpoints() {
9079 }
9180
9281 private static void callEndpoint (String endpoint ) {
93- Timer .Context timer = metricRegistry .timer (endpoint ).time ();
9482 URL url ;
9583 try {
9684 url = new URL ("http://localhost:8080" + endpoint );
@@ -104,14 +92,12 @@ private static void callEndpoint(String endpoint) {
10492 connection = (HttpURLConnection ) url .openConnection ();
10593 connection .setConnectTimeout (10_000 );
10694 connection .setReadTimeout (10_000 );
107- int responseCode = connection .getResponseCode ();
108- System .out .println ("Response code: " + responseCode );
95+ connection .getResponseCode ();
10996 } catch (Exception ignore ) {
11097 } finally {
11198 if (connection != null ) {
11299 connection .disconnect ();
113100 }
114- timer .close ();
115101 }
116102 });
117103 }
0 commit comments