You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/10/16 09:58:27 UTC
[dubbo] branch master updated: netty3 backlog (#5169)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new a0b1620 netty3 backlog (#5169)
a0b1620 is described below
commit a0b1620d46ded6b1dd20d6a2e814079798ec889f
Author: Haiyang <ha...@163.com>
AuthorDate: Wed Oct 16 17:58:19 2019 +0800
netty3 backlog (#5169)
---
.../main/java/org/apache/dubbo/common/constants/CommonConstants.java | 2 ++
.../src/main/java/org/apache/dubbo/remoting/Constants.java | 4 +++-
.../java/org/apache/dubbo/remoting/transport/netty/NettyServer.java | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
index a058cca..067bd96 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
@@ -189,4 +189,6 @@ public interface CommonConstants {
String CONFIG_ENABLE_KEY = "highest-priority";
String CONFIG_NAMESPACE_KEY = "namespace";
String CHECK_KEY = "check";
+
+ String BACKLOG_KEY = "backlog";
}
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
index 8fd6361..d134ae4 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
@@ -41,7 +41,7 @@ public interface Constants {
*/
String ACCEPTS_KEY = "accepts";
- int DEFAULT_ACCEPTS = 0;
+ int DEFAULT_ACCEPTS = 0;
String CONNECT_QUEUE_CAPACITY = "connect.queue.capacity";
@@ -136,4 +136,6 @@ public interface Constants {
String HEARTBEAT_TIMEOUT_KEY = "heartbeat.timeout";
String CONNECTIONS_KEY = "connections";
String DUBBO_VERSION_KEY = "dubbo";
+
+ int DEFAULT_BACKLOG = 1024;
}
diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyServer.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyServer.java
index 8d1cc3f..9f5914b 100644
--- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyServer.java
+++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyServer.java
@@ -45,6 +45,7 @@ import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import static org.apache.dubbo.common.constants.CommonConstants.BACKLOG_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.IO_THREADS_KEY;
/**
@@ -78,6 +79,7 @@ public class NettyServer extends AbstractServer implements Server {
// https://issues.jboss.org/browse/NETTY-379
// final Timer timer = new HashedWheelTimer(new NamedThreadFactory("NettyIdleTimer", true));
bootstrap.setOption("child.tcpNoDelay", true);
+ bootstrap.setOption("backlog", getUrl().getPositiveParameter(BACKLOG_KEY, Constants.DEFAULT_BACKLOG));
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() {