This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 7d49fbb [Improvement][remote] set connect time out (#3670)
7d49fbb is described below
commit 7d49fbbaec1ffee60512313e18e1902e40fc4626
Author: CalvinKirs <[email protected]>
AuthorDate: Sun Sep 6 16:31:35 2020 +0800
[Improvement][remote] set connect time out (#3670)
---
.../remote/NettyRemotingClient.java | 1 +
.../remote/config/NettyClientConfig.java | 23 +++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingClient.java
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingClient.java
index e5e3430..38f00fb 100644
---
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingClient.java
+++
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingClient.java
@@ -159,6 +159,7 @@ public class NettyRemotingClient {
.option(ChannelOption.TCP_NODELAY, clientConfig.isTcpNoDelay())
.option(ChannelOption.SO_SNDBUF, clientConfig.getSendBufferSize())
.option(ChannelOption.SO_RCVBUF,
clientConfig.getReceiveBufferSize())
+ .option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
clientConfig.getConnectTimeoutMillis())
.handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
diff --git
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/config/NettyClientConfig.java
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/config/NettyClientConfig.java
index 831e05f..739cbbe 100644
---
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/config/NettyClientConfig.java
+++
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/config/NettyClientConfig.java
@@ -14,22 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.dolphinscheduler.remote.config;
import org.apache.dolphinscheduler.remote.utils.Constants;
/**
- * netty client config
+ * netty client config
*/
public class NettyClientConfig {
/**
- * worker threads,default get machine cpus
+ * worker threads,default get machine cpus
*/
private int workerThreads = Constants.CPUS;
/**
- * whether tpc delay
+ * whether tpc delay
*/
private boolean tcpNoDelay = true;
@@ -39,15 +40,20 @@ public class NettyClientConfig {
private boolean soKeepalive = true;
/**
- * send buffer size
+ * send buffer size
*/
private int sendBufferSize = 65535;
/**
- * receive buffer size
+ * receive buffer size
*/
private int receiveBufferSize = 65535;
+ /**
+ * connect timeout millis
+ */
+ private int connectTimeoutMillis = 3000;
+
public int getWorkerThreads() {
return workerThreads;
}
@@ -88,4 +94,11 @@ public class NettyClientConfig {
this.receiveBufferSize = receiveBufferSize;
}
+ public int getConnectTimeoutMillis() {
+ return connectTimeoutMillis;
+ }
+
+ public void setConnectTimeoutMillis(int connectTimeoutMillis) {
+ this.connectTimeoutMillis = connectTimeoutMillis;
+ }
}