浼樺寲ClientExecutor鐨勭嚎绋嬫暟

This commit is contained in:
Redkale
2023-01-13 19:17:49 +08:00
parent 25214db1dd
commit 48e1c5dc86

View File

@@ -581,11 +581,10 @@ public final class Application {
} }
ExecutorService workExecutor0 = null; ExecutorService workExecutor0 = null;
ExecutorService clientExecutor;
if (executorConf == null) { if (executorConf == null) {
executorConf = DefaultAnyValue.create(); executorConf = DefaultAnyValue.create();
} }
final int workThreads = executorConf.getIntValue("threads", Math.max(2, Utility.cpus())); final int workThreads = executorConf.getIntValue("threads", Utility.cpus() * 4);
boolean workHash = executorConf.getBoolValue("hash", false); boolean workHash = executorConf.getBoolValue("hash", false);
if (workThreads > 0) { if (workThreads > 0) {
if (workHash) { if (workHash) {
@@ -594,10 +593,10 @@ public final class Application {
workExecutor0 = WorkThread.createExecutor(workThreads, "Redkale-WorkThread-%s"); workExecutor0 = WorkThread.createExecutor(workThreads, "Redkale-WorkThread-%s");
} }
} }
clientExecutor = workExecutor0; ExecutorService clientExecutor = workExecutor0;
if (clientExecutor == null) { if (clientExecutor == null) {
//给所有client给一个默认的ExecutorService //给所有client给一个默认的ExecutorService
final int clientThreads = Math.max(Math.max(2, Utility.cpus()), workThreads); final int clientThreads = executorConf.getIntValue("clients", Utility.cpus());
clientExecutor = WorkThread.createExecutor(clientThreads, "Redkale-DefaultClient-WorkThread-%s"); clientExecutor = WorkThread.createExecutor(clientThreads, "Redkale-DefaultClient-WorkThread-%s");
} }