This is an automated email from the ASF dual-hosted git repository.

clolov pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 22d4248fbaa KAFKA-18694: Migrate suitable classes to records in 
coordinator-common module (#18782)
22d4248fbaa is described below

commit 22d4248fbaa04e3f721d049c01035cfbdf5b9c4b
Author: Nick Guo <[email protected]>
AuthorDate: Wed Feb 5 18:50:55 2025 +0800

    KAFKA-18694: Migrate suitable classes to records in coordinator-common 
module (#18782)
    
    Reviewers: TengYao Chi <[email protected]>, Ken Huang 
<[email protected]>, Christo Lolov <[email protected]>
---
 .../common/runtime/CoordinatorExecutorImpl.java    | 13 +-----
 .../common/runtime/CoordinatorLoader.java          | 46 +---------------------
 .../coordinator/common/runtime/HdrHistogram.java   | 11 +-----
 3 files changed, 3 insertions(+), 67 deletions(-)

diff --git 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorExecutorImpl.java
 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorExecutorImpl.java
index f9a417b0e86..bcd8fc795fb 100644
--- 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorExecutorImpl.java
+++ 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorExecutorImpl.java
@@ -31,18 +31,7 @@ import java.util.concurrent.ExecutorService;
 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) { }
 
     private final Logger log;
     private final TopicPartition shard;
diff --git 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorLoader.java
 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorLoader.java
index 4f739082d67..b268e22164c 100644
--- 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorLoader.java
+++ 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorLoader.java
@@ -32,51 +32,7 @@ public interface CoordinatorLoader<U> extends AutoCloseable {
      * 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) { }
 
     /**
      * Loads the coordinator by reading all the records from the TopicPartition
diff --git 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/HdrHistogram.java
 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/HdrHistogram.java
index ac618430e93..5cda3fd44c2 100644
--- 
a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/HdrHistogram.java
+++ 
b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/HdrHistogram.java
@@ -133,15 +133,6 @@ public final class HdrHistogram {
      * 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) { }
 
 }

Reply via email to