nsivabalan commented on code in PR #13851:
URL: https://github.com/apache/hudi/pull/13851#discussion_r2337983460
##########
hudi-common/src/main/java/org/apache/hudi/metrics/prometheus/PrometheusReporter.java:
##########
@@ -101,12 +148,86 @@ public void report() {
@Override
public void stop() {
- collectorRegistry.unregister(metricExports);
- HTTPServer httpServer = PORT_TO_SERVER.remove(serverPort);
- if (httpServer != null) {
- httpServer.stop();
+ if (stopped.get()) {
Review Comment:
oh btw. where are we resetting the `stopped=false` back.
we could expect multiple calls to `stop` method right. and only when
refCount reaches 0, we would want to actually clean up the server (close http
connection).
but from what I see, we set `stopped = true` on first call only. And any
subsequent calls will never execute anything beyond line 152.
am I missing something here
##########
hudi-common/src/main/java/org/apache/hudi/metrics/prometheus/PrometheusReporter.java:
##########
@@ -101,12 +148,86 @@ public void report() {
@Override
public void stop() {
- collectorRegistry.unregister(metricExports);
- HTTPServer httpServer = PORT_TO_SERVER.remove(serverPort);
- if (httpServer != null) {
- httpServer.stop();
+ if (stopped.get()) {
Review Comment:
minor.
if we really don't need the debug log in L152, we could do
```
if (!stopped.getAndSet(true)){
stop...
...
}
```
we could avoid synchronized in L 157
and explicitly setting stopped = true in L 158
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]