From 34fb441817d9682543066df7a570ba7d467ac26f Mon Sep 17 00:00:00 2001 From: redkale Date: Mon, 27 Mar 2023 21:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96workexecutor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/redkale/boot/Application.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/redkale/boot/Application.java b/src/main/java/org/redkale/boot/Application.java index e6cf5aff4..887bd901c 100644 --- a/src/main/java/org/redkale/boot/Application.java +++ b/src/main/java/org/redkale/boot/Application.java @@ -579,20 +579,13 @@ public final class Application { } final int workThreads = executorConf.getIntValue("threads", Utility.cpus() * 4); boolean workHash = executorConf.getBoolValue("hash", false); - if (!Boolean.getBoolean("redkale.http.request.pipeline.sameheaders") && workThreads > 0) { + if (workThreads > 0) { if (workHash) { workExecutor0 = WorkThread.createHashExecutor(workThreads, "Redkale-HashWorkThread-%s"); } else { workExecutor0 = WorkThread.createExecutor(workThreads, "Redkale-WorkThread-%s"); } } - ExecutorService clientExecutor = workExecutor0; - if (clientExecutor == null) { - //给所有client给一个默认的ExecutorService - final int clientThreads = executorConf.getIntValue("clients", Utility.cpus()); - clientExecutor = WorkThread.createExecutor(clientThreads, "Redkale-DefaultClient-WorkThread-%s"); - } - this.workExecutor = workExecutor0; this.resourceFactory.register(RESNAME_APP_EXECUTOR, Executor.class, this.workExecutor); this.resourceFactory.register(RESNAME_APP_EXECUTOR, ExecutorService.class, this.workExecutor); @@ -604,6 +597,11 @@ public final class Application { this.clientAsyncGroup = this.globalAsyncGroup; } else { this.globalAsyncGroup = null; + ExecutorService clientExecutor = workExecutor0; + if (clientExecutor == null) { + //给所有client给一个默认的ExecutorService + clientExecutor = WorkThread.createExecutor(executorConf.getIntValue("clients", Utility.cpus()), "Redkale-DefaultClient-WorkThread-%s"); + } this.clientAsyncGroup = new AsyncIOGroup("Redkale-DefaultClient-IOThread-%s", clientExecutor, bufferCapacity, bufferPoolSize).skipClose(true); } this.resourceFactory.register(RESNAME_APP_CLIENT_IOGROUP, AsyncGroup.class, this.clientAsyncGroup);