chia7712 commented on code in PR #20751:
URL: https://github.com/apache/kafka/pull/20751#discussion_r2472795021
##########
clients/src/test/java/org/apache/kafka/common/header/internals/RecordHeadersTest.java:
##########
@@ -265,4 +273,65 @@ static void assertHeader(String key, String value, Header
actual) {
assertArrayEquals(value.getBytes(), actual.value());
}
+ @RepeatedTest(100)
+ public void testRecordHeaderIsReadThreadSafe() throws Exception {
+ int threads = 32;
+ RecordHeader header = new RecordHeader(
+ ByteBuffer.wrap("key".getBytes(StandardCharsets.UTF_8)),
+ ByteBuffer.wrap("value".getBytes(StandardCharsets.UTF_8))
+ );
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+ AtomicBoolean raceDetected = new AtomicBoolean(false);
+
+ var fs = IntStream.range(0, threads)
Review Comment:
Could you please refactor the code to eliminate the duplicate code?
--
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]