chia7712 commented on code in PR #20564:
URL: https://github.com/apache/kafka/pull/20564#discussion_r2912608692
##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java:
##########
@@ -2394,6 +2394,10 @@ protected synchronized void
recordTaskAdded(ConnectorTaskId connectorTaskId) {
}
protected synchronized void recordTaskRemoved(ConnectorTaskId
connectorTaskId) {
Review Comment:
Could you consider using the following style:
```java
protected synchronized void recordTaskRemoved(ConnectorTaskId
connectorTaskId) {
// Unregister connector task count metric if we remove the last
task of the connector
if (tasks.keySet().stream().noneMatch(id ->
id.connector().equals(connectorTaskId.connector()))) {
var metricGroup =
connectorStatusMetrics.remove(connectorTaskId.connector());
if (metricGroup != null) metricGroup.close();
}
}
```
--
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]