kylixs commented on a change in pull request #8983:
URL: https://github.com/apache/dubbo/pull/8983#discussion_r771085938



##########
File path: 
dubbo-metrics/dubbo-metrics-prometheus/src/main/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporter.java
##########
@@ -93,7 +94,8 @@ private void exportHttpServer() {
                     }
                 });
 
-                new Thread(prometheusExporterHttpServer::start).start();
+                httpServerThread = new 
Thread(prometheusExporterHttpServer::start);
+                httpServerThread.start();

Review comment:
       The http server management seems a bit strange, see about: 
https://stackoverflow.com/a/2917297
   Use executor service likes better.
   ```java
       this.httpServer = HttpServer.create(addr, 0);
       HttpContext context = this.httpServer.createContext("/", new 
DocumentProcessHandler());
       this.httpThreadPool = Executors.newFixedThreadPool(this.noOfThreads);
       this.httpServer.setExecutor(this.httpThreadPool);
       this.httpServer.start();
   ```
   
   ```java
           this.httpServer.stop(1);
           this.httpThreadPool.shutdownNow();
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to