frankvicky commented on code in PR #18782:
URL: https://github.com/apache/kafka/pull/18782#discussion_r1938906951


##########
coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorLoader.java:
##########
@@ -49,50 +49,7 @@ public short unknownType() {
      * Object that is returned as part of the future from load(). Holds the 
partition load time and the
      * end time.
      */
-    class LoadSummary {
-        private final long startTimeMs;
-        private final long endTimeMs;
-        private final long schedulerQueueTimeMs;
-        private final long numRecords;
-        private final long numBytes;
-
-        public LoadSummary(long startTimeMs, long endTimeMs, long 
schedulerQueueTimeMs, long numRecords, long numBytes) {
-            this.startTimeMs = startTimeMs;
-            this.endTimeMs = endTimeMs;
-            this.schedulerQueueTimeMs = schedulerQueueTimeMs;
-            this.numRecords = numRecords;
-            this.numBytes = numBytes;
-        }
-
-        public long startTimeMs() {
-            return startTimeMs;
-        }
-
-        public long endTimeMs() {
-            return endTimeMs;
-        }
-
-        public long schedulerQueueTimeMs() {
-            return schedulerQueueTimeMs;
-        }
-
-        public long numRecords() {
-            return numRecords;
-        }
-
-        public long numBytes() {
-            return numBytes;
-        }
-
-        @Override
-        public String toString() {
-            return "LoadSummary(" +
-                "startTimeMs=" + startTimeMs +
-                ", endTimeMs=" + endTimeMs +
-                ", schedulerQueueTimeMs=" + schedulerQueueTimeMs +
-                ", numRecords=" + numRecords +
-                ", numBytes=" + numBytes + ")";
-        }
+    record LoadSummary(long startTimeMs, long endTimeMs, long 
schedulerQueueTimeMs, long numRecords, long numBytes) {
     }

Review Comment:
   ditto



##########
coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorExecutorImpl.java:
##########
@@ -31,17 +31,7 @@
 import java.util.concurrent.RejectedExecutionException;
 
 public class CoordinatorExecutorImpl<S extends CoordinatorShard<U>, U> 
implements CoordinatorExecutor<U> {
-    private static class TaskResult<R> {
-        final R result;
-        final Throwable exception;
-
-        TaskResult(
-            R result,
-            Throwable exception
-        ) {
-            this.result = result;
-            this.exception = exception;
-        }
+    private record TaskResult<R>(R result, Throwable exception) {
     }

Review Comment:
   Could we merge them into one line?
   ```suggestion
       private record TaskResult<R>(R result, Throwable exception) { }
   ```



##########
coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/HdrHistogram.java:
##########
@@ -133,15 +133,7 @@ public double measurePercentile(long now, double 
percentile) {
      * A simple tuple of a timestamp and a value. Can be used updating a value 
and recording the
      * timestamp of the update in a single atomic operation.
      */
-    private static final class Timestamped<T> {
-
-        private final long timestamp;
-        private final T value;
-
-        private Timestamped(long timestamp, T value) {
-            this.timestamp = timestamp;
-            this.value = value;
-        }
+    private record Timestamped<T>(long timestamp, T value) {
     }

Review Comment:
   ditto



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to