Skip to content

Commit

Permalink
use global threadpool to send msg
Browse files Browse the repository at this point in the history
  • Loading branch information
tynan.liu committed Jun 28, 2022
1 parent 78983cb commit 94e35ef
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ public class NodeImpl implements Node, RaftServerService {
private volatile int targetPriority;
/** The number of elections time out for current node */
private volatile int electionTimeoutCounter;
private static volatile FixedThreadsExecutorGroup appendEntriesExecutors;
private static final Object INIT_LOCK = new Object();
private static volatile FixedThreadsExecutorGroup appendEntriesExecutors;
private static final Object INIT_LOCK = new Object();

private static class NodeReadWriteLock extends LongHeldDetectingReadWriteLock {

static final long MAX_BLOCKING_MS_TO_REPORT = SystemPropertyUtil.getLong(
Expand Down Expand Up @@ -876,8 +877,8 @@ private FixedThreadsExecutorGroup getDefaultThreadPoolForSendMsg() {
synchronized (INIT_LOCK) {
if (appendEntriesExecutors == null) {
appendEntriesExecutors = DefaultFixedThreadsExecutorGroupFactory.INSTANCE.newExecutorGroup(
Utils.APPEND_ENTRIES_THREADS_SEND, "Append-Entries-Thread-Send",
Utils.MAX_APPEND_ENTRIES_TASKS_PER_THREAD, true);
Utils.APPEND_ENTRIES_THREADS_SEND, "Append-Entries-Thread-Send",
Utils.MAX_APPEND_ENTRIES_TASKS_PER_THREAD, true);
}
}
}
Expand Down

0 comments on commit 94e35ef

Please sign in to comment.