jsancio commented on code in PR #21163:
URL: https://github.com/apache/kafka/pull/21163#discussion_r2718129884


##########
server/src/main/java/org/apache/kafka/server/metrics/DefaultExternalKRaftMetrics.java:
##########
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.kafka.server.metrics;
 
-package kafka.raft
+import org.apache.kafka.controller.metrics.ControllerMetadataMetrics;
+import org.apache.kafka.raft.ExternalKRaftMetrics;
 
-import org.apache.kafka.controller.metrics.ControllerMetadataMetrics
-import org.apache.kafka.raft.ExternalKRaftMetrics
-import org.apache.kafka.server.metrics.BrokerServerMetrics
+import java.util.Optional;
 
-class DefaultExternalKRaftMetrics(
-  val brokerServerMetrics: Option[BrokerServerMetrics],
-  val controllerMetadataMetrics: Option[ControllerMetadataMetrics]
-) extends ExternalKRaftMetrics {
+public record DefaultExternalKRaftMetrics(
+        Optional<BrokerServerMetrics> brokerServerMetrics,
+        Optional<ControllerMetadataMetrics> controllerMetadataMetrics) 
implements ExternalKRaftMetrics {

Review Comment:
   @mimaison I don't think we should use Java's record object for this case. 
This is summary explanation for record:
   
   >A record declaration specifies in a header a description of its contents; 
the appropriate accessors, constructor, equals, hashCode, and toString methods 
are created automatically. A record's fields are final because the class is 
intended to serve as a simple "data carrier".
   
   BrokerServerMetrics and ControllerMetadataMetrics are not "records". They 
don't implement equals, hashCode, toString. They are not "simple data carriers" 
so the composition DefaultExternalKRaftMetrics is also no a "simple data 
carrier."
   
   What do you think?



-- 
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]

Reply via email to