From be2c803f824a38df3cae0d6db4d40f99c3f940ce Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Mon, 6 Aug 2018 17:38:03 +0800 Subject: [PATCH] --- src/org/redkale/boot/Application.java | 2 +- src/org/redkale/net/TcpAioProtocolServer.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/redkale/boot/Application.java b/src/org/redkale/boot/Application.java index 610468d2a..1a5c8fe57 100644 --- a/src/org/redkale/boot/Application.java +++ b/src/org/redkale/boot/Application.java @@ -171,6 +171,7 @@ public final class Application { this.singletonrun = singletonrun; this.config = config; System.setProperty("redkale.version", Redkale.getDotedVersion()); + System.setProperty("sun.nio.ch.maxCompletionHandlersOnStack", String.valueOf(Runtime.getRuntime().availableProcessors() * 32)); final File root = new File(System.getProperty(RESNAME_APP_HOME)); this.resourceFactory.register(RESNAME_APP_TIME, long.class, this.startTime); @@ -388,7 +389,6 @@ public final class Application { } public void init() throws Exception { - System.setProperty("sun.nio.ch.internalThreadPoolSize", "" + Runtime.getRuntime().availableProcessors() * 4); System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "" + Runtime.getRuntime().availableProcessors() * 4); System.setProperty("net.transport.poolmaxconns", "100"); System.setProperty("net.transport.pinginterval", "30"); diff --git a/src/org/redkale/net/TcpAioProtocolServer.java b/src/org/redkale/net/TcpAioProtocolServer.java index 2f150e108..eb76d8351 100644 --- a/src/org/redkale/net/TcpAioProtocolServer.java +++ b/src/org/redkale/net/TcpAioProtocolServer.java @@ -32,7 +32,8 @@ public class TcpAioProtocolServer extends ProtocolServer { @Override public void open(AnyValue config) throws IOException { - group = AsynchronousChannelGroup.withThreadPool(context.executor); + //group = AsynchronousChannelGroup.withThreadPool(context.executor); + group = AsynchronousChannelGroup.withFixedThreadPool(context.executor.getCorePoolSize(), context.executor.getThreadFactory()); this.serverChannel = AsynchronousServerSocketChannel.open(group); final Set> options = this.serverChannel.supportedOptions();