This is an automated email from the ASF dual-hosted git repository.

fanjia pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new cb3db75972 [Fix][Zeta] improve the local mode hazelcast connection 
(#6521)
cb3db75972 is described below

commit cb3db759728eb34e85bdeb6765f821f5699391a5
Author: Jarvis <[email protected]>
AuthorDate: Sun Mar 17 23:06:42 2024 +0800

    [Fix][Zeta] improve the local mode hazelcast connection (#6521)
---
 .../core/starter/seatunnel/command/ClientExecuteCommand.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java
 
b/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java
index ad41ae983c..980832f4de 100644
--- 
a/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java
+++ 
b/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java
@@ -48,6 +48,7 @@ import lombok.extern.slf4j.Slf4j;
 import java.nio.file.Path;
 import java.time.Duration;
 import java.time.LocalDateTime;
+import java.util.Collections;
 import java.util.Random;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executors;
@@ -79,6 +80,7 @@ public class ClientExecuteCommand implements 
Command<ClientCommandArgs> {
         SeaTunnelConfig seaTunnelConfig = 
ConfigProvider.locateAndGetSeaTunnelConfig();
         try {
             String clusterName = clientCommandArgs.getClusterName();
+            ClientConfig clientConfig = 
ConfigProvider.locateAndGetClientConfig();
             if (clientCommandArgs.getMasterType().equals(MasterType.LOCAL)) {
                 clusterName =
                         creatRandomClusterName(
@@ -86,12 +88,13 @@ public class ClientExecuteCommand implements 
Command<ClientCommandArgs> {
                                         ? clusterName
                                         : 
Constant.DEFAULT_SEATUNNEL_CLUSTER_NAME);
                 instance = createServerInLocal(clusterName, seaTunnelConfig);
+                int port = 
instance.getCluster().getLocalMember().getSocketAddress().getPort();
+                clientConfig
+                        .getNetworkConfig()
+                        .setAddresses(Collections.singletonList("localhost:" + 
port));
             }
             if (StringUtils.isNotEmpty(clusterName)) {
                 
seaTunnelConfig.getHazelcastConfig().setClusterName(clusterName);
-            }
-            ClientConfig clientConfig = 
ConfigProvider.locateAndGetClientConfig();
-            if (StringUtils.isNotEmpty(clusterName)) {
                 clientConfig.setClusterName(clusterName);
             }
             engineClient = new SeaTunnelClient(clientConfig);

Reply via email to