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

diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-flink-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new a46533b  minor optimize (#123)
a46533b is described below

commit a46533bd2185e7a9faab881ca43e9d8c9b0db712
Author: benjobs <[email protected]>
AuthorDate: Tue Mar 14 15:09:43 2023 +0800

    minor optimize (#123)
    
    * minor optimize,Update BackendClient.java
    ---------
    Co-authored-by: benjobs <[email protected]>
---
 .../main/java/org/apache/doris/flink/backend/BackendClient.java  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/backend/BackendClient.java
 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/backend/BackendClient.java
index f55d148..e81cea8 100644
--- 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/backend/BackendClient.java
+++ 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/backend/BackendClient.java
@@ -69,27 +69,24 @@ public class BackendClient {
     private void open() {
         logger.debug("Open client to Doris BE '{}'.", routing);
         TException ex = null;
-        for (int attempt = 0; !isConnected && attempt < retries; ++attempt) {
+        for (int attempt = 0; attempt < retries; ++attempt) {
             logger.debug("Attempt {} to connect {}.", attempt, routing);
             TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory();
             transport = new TSocket(routing.getHost(), routing.getPort(), 
socketTimeout, connectTimeout);
             TProtocol protocol = factory.getProtocol(transport);
             client = new TDorisExternalService.Client(protocol);
-            if (isConnected) {
-                logger.info("Success connect to {}.", routing);
-                return;
-            }
             try {
                 logger.trace("Connect status before open transport to {} is 
'{}'.", routing, isConnected);
                 if (!transport.isOpen()) {
                     transport.open();
                     isConnected = true;
+                    logger.info("Success connect to {}.", routing);
+                    break;
                 }
             } catch (TTransportException e) {
                 logger.warn(ErrorMessages.CONNECT_FAILED_MESSAGE, routing, e);
                 ex = e;
             }
-
         }
         if (!isConnected) {
             logger.error(ErrorMessages.CONNECT_FAILED_MESSAGE, routing);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to