From fb8305fc71e372fa683a59cb24b8a6814657321c Mon Sep 17 00:00:00 2001 From: Yike Xiao Date: Thu, 6 Mar 2025 15:31:58 +0800 Subject: [PATCH 1/2] Set ThreadFactory for Executor in EntryLoggerAllocator --- .../org/apache/bookkeeper/bookie/EntryLoggerAllocator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java index 70b76aaf376..96c4302421c 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java @@ -43,6 +43,8 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; + +import io.netty.util.concurrent.DefaultThreadFactory; import lombok.extern.slf4j.Slf4j; import org.apache.bookkeeper.bookie.DefaultEntryLogger.BufferedLogChannel; import org.apache.bookkeeper.conf.ServerConfiguration; @@ -76,7 +78,8 @@ class EntryLoggerAllocator { this.preallocatedLogId = logId; this.recentlyCreatedEntryLogsStatus = recentlyCreatedEntryLogsStatus; this.entryLogPreAllocationEnabled = conf.isEntryLogFilePreAllocationEnabled(); - this.allocatorExecutor = Executors.newSingleThreadExecutor(); + this.allocatorExecutor = Executors.newSingleThreadExecutor( + new DefaultThreadFactory("EntryLoggerAllocator")); // Initialize the entry log header buffer. This cannot be a static object // since in our unit tests, we run multiple Bookies and thus EntryLoggers From 0815d9480b07dfbf60a1ce25fdbb1e4b5b8a4e8f Mon Sep 17 00:00:00 2001 From: Yike Xiao Date: Fri, 7 Mar 2025 08:18:14 +0800 Subject: [PATCH 2/2] Address checkstyle violation --- .../org/apache/bookkeeper/bookie/EntryLoggerAllocator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java index 96c4302421c..c229e5e816e 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java @@ -28,6 +28,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.Unpooled; +import io.netty.util.concurrent.DefaultThreadFactory; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; @@ -43,8 +44,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; - -import io.netty.util.concurrent.DefaultThreadFactory; import lombok.extern.slf4j.Slf4j; import org.apache.bookkeeper.bookie.DefaultEntryLogger.BufferedLogChannel; import org.apache.bookkeeper.conf.ServerConfiguration;