diff --git a/src/main/java/META-INF/application-template.xml b/src/main/java/META-INF/application-template.xml index 97b528d6f..246f48c9d 100644 --- a/src/main/java/META-INF/application-template.xml +++ b/src/main/java/META-INF/application-template.xml @@ -146,8 +146,8 @@ bufferPoolSize: ByteBuffer池的大小,默认: 线程数*4 responsePoolSize: Response池的大小,默认: 1024 aliveTimeoutSeconds: KeepAlive读操作超时秒数, 默认30, 0表示永久不超时; -1表示禁止KeepAlive - readTimeoutSeconds: 读操作超时秒数, 默认0, 表示永久不超时 - writeTimeoutSeconds: 写操作超时秒数, 默认0, 表示永久不超时 + readTimeoutSeconds: 读操作超时秒数, 默认0, 0表示永久不超时 + writeTimeoutSeconds: 写操作超时秒数, 默认0, 0表示永久不超时 interceptor: 启动/关闭NodeServer时被调用的拦截器实现类,必须是org.redkale.boot.NodeInterceptor的子类,默认为null --> diff --git a/src/main/java/org/redkale/boot/Application.java b/src/main/java/org/redkale/boot/Application.java index 7639b1a7e..89e14b836 100644 --- a/src/main/java/org/redkale/boot/Application.java +++ b/src/main/java/org/redkale/boot/Application.java @@ -444,8 +444,6 @@ public final class Application { MessageAgent[] mqs = null; int bufferCapacity = 32 * 1024; int bufferPoolSize = Utility.cpus() * 8; - int readTimeoutSeconds = 6; - int writeTimeoutSeconds = 6; AnyValue executorConf = null; executorConf = config.getAnyValue("executor"); AnyValue excludelibConf = config.getAnyValue("excludelibs"); @@ -1342,7 +1340,7 @@ public final class Application { try { DatagramChannel channel = DatagramChannel.open(); channel.configureBlocking(true); - channel.socket().setSoTimeout(3000); + channel.socket().setSoTimeout(6000); //单位:毫秒 channel.bind(new InetSocketAddress("127.0.0.1", config.getIntValue("port"))); if (!singletonMode) { signalShutdownHandle(); @@ -1471,7 +1469,7 @@ public final class Application { private static void sendCommand(Logger logger, int port, String cmd, String[] params) throws Exception { final DatagramChannel channel = DatagramChannel.open(); channel.configureBlocking(true); - channel.socket().setSoTimeout(3000); + channel.socket().setSoTimeout(6000); //单位:毫秒 SocketAddress dest = new InetSocketAddress("127.0.0.1", port); channel.connect(dest); //命令和参数合成一个数组 diff --git a/src/main/java/org/redkale/net/AsyncIOGroup.java b/src/main/java/org/redkale/net/AsyncIOGroup.java index daa08dfc0..acf11eff6 100644 --- a/src/main/java/org/redkale/net/AsyncIOGroup.java +++ b/src/main/java/org/redkale/net/AsyncIOGroup.java @@ -192,10 +192,6 @@ public class AsyncIOGroup extends AsyncGroup { return ioWriteThreads[i]; } - public AsyncIOThread connectThread() { - return connectThread; - } - @Override public ScheduledFuture scheduleTimeout(Runnable callable, long delay, TimeUnit unit) { return timeoutExecutor.schedule(callable, delay, unit); diff --git a/src/main/java/org/redkale/net/Server.java b/src/main/java/org/redkale/net/Server.java index 0ec190aa6..67999a8d5 100644 --- a/src/main/java/org/redkale/net/Server.java +++ b/src/main/java/org/redkale/net/Server.java @@ -463,6 +463,14 @@ public abstract class Server wsmappings = new HashMap<>(); //super.mappings 包含 wsmappings + protected Map wsMappings = new HashMap<>(); //super.mappings 包含 wsMappings protected final Map allMapStrings = new HashMap<>(); @@ -82,17 +82,17 @@ public class HttpDispatcherServlet extends DispatcherServlet newwsmappings = new HashMap<>(); - for (Map.Entry en : wsmappings.entrySet()) { + Map newWsMappings = new HashMap<>(); + for (Map.Entry en : wsMappings.entrySet()) { if (predicateFilter.test(en)) { servlets.add(en.getValue()); keys.add(en.getKey()); } else { - newwsmappings.put(en.getKey(), en.getValue()); + newWsMappings.put(en.getKey(), en.getValue()); } } - if (newwsmappings.size() != wsmappings.size()) { - this.wsmappings = newwsmappings; + if (newWsMappings.size() != wsMappings.size()) { + this.wsMappings = newWsMappings; } if (!keys.isEmpty()) { this.regxArray = Utility.remove(this.regxArray, predicateEntry); @@ -320,7 +320,7 @@ public class HttpDispatcherServlet extends DispatcherServlet newMappings = new HashMap<>(wsmappings); + Map newMappings = new HashMap<>(wsMappings); newMappings.put(mappingPath, (WebSocketServlet) servlet); - this.wsmappings = newMappings; + this.wsMappings = newMappings; } } if (this.allMapStrings.containsKey(mappingPath)) { @@ -545,7 +545,7 @@ public class HttpDispatcherServlet extends DispatcherServlet 0 ? timeoutMs : 3000); -// conn.setReadTimeout(timeoutMs > 0 ? timeoutMs : 3000); +// conn.setConnectTimeout(timeoutMs > 0 ? timeoutMs : 30000); +// conn.setReadTimeout(timeoutMs > 0 ? timeoutMs : 30000); // if (conn instanceof HttpsURLConnection) { // HttpsURLConnection httpsconn = ((HttpsURLConnection) conn); // httpsconn.setSSLSocketFactory((ctx == null ? DEFAULTSSL_CONTEXT : ctx).getSocketFactory());