Skip to content

Commit

Permalink
[ISSUE-#4762] Naming health check thread num support user define it b…
Browse files Browse the repository at this point in the history
…y self. (#4764)

* NAMING_HEALTH_EXECUTOR support user define it by self.

* promise less one thread to process the health check task.
  • Loading branch information
horizonzy committed Jan 27, 2021
1 parent d4d245f commit 2db2a85
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public class GlobalExecutor {
new NameThreadFactory("com.alibaba.nacos.naming.tcp.check.worker"));

private static final ScheduledExecutorService NAMING_HEALTH_EXECUTOR = ExecutorFactory.Managed
.newScheduledExecutorService(ClassUtils.getCanonicalName(NamingApp.class), DEFAULT_THREAD_COUNT,
new NameThreadFactory("com.alibaba.nacos.naming.health"));
.newScheduledExecutorService(ClassUtils.getCanonicalName(NamingApp.class),
Integer.max(Integer.getInteger("com.alibaba.nacos.naming.health.thread.num", DEFAULT_THREAD_COUNT),
1), new NameThreadFactory("com.alibaba.nacos.naming.health"));

private static final ScheduledExecutorService RETRANSMITTER_EXECUTOR = ExecutorFactory.Managed
.newSingleScheduledExecutorService(ClassUtils.getCanonicalName(NamingApp.class),
Expand Down Expand Up @@ -142,7 +143,7 @@ public static void scheduleMcpPushTask(Runnable runnable, long initialDelay, lon
public static ScheduledFuture submitClusterVersionJudge(Runnable runnable, long delay) {
return NAMING_TIMER_EXECUTOR.schedule(runnable, delay, TimeUnit.MILLISECONDS);
}

public static void submitDistroNotifyTask(Runnable runnable) {
DISTRO_NOTIFY_EXECUTOR.submit(runnable);
}
Expand Down

0 comments on commit 2db2a85

Please sign in to comment.