HenryCaiHaiying commented on code in PR #17025:
URL: https://github.com/apache/iceberg/pull/17025#discussion_r3787973258
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Coordinator.java:
##########
@@ -440,4 +455,13 @@ void terminate() {
throw new ConnectException("Interrupted while waiting for coordinator
shutdown", e);
}
}
+
+ @Override
+ void stop() {
+ // stop() runs at the very end of the CoordinatorThread run loop, after
process() (and any
+ // commit() recording) can no longer fire, so closing the registry here
avoids racing a
+ // record* call against a closed Metrics instance.
+ super.stop();
Review Comment:
Instead of waiting between terminate() and stop() which is precarious, I
will also call 'coordinatorMetrics.close();' during terminate(). And in order
to prevent 'metric.close()' being called twice, I will just set the metrics to
null on the first close() and the second call will check metrics variable. And
make metrics instance variable volatile and a synchronized protection too.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]