davidzollo commented on code in PR #10292:
URL: https://github.com/apache/seatunnel/pull/10292#discussion_r2668827604


##########
seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/source/StarRocksBeReadClient.java:
##########
@@ -186,13 +186,30 @@ public SeaTunnelRow getNext() {
 
     public void close() {
         log.info("Close reader for {}:{} with context id {}", ip, port, 
contextId);
+        if (contextId == null) {
+            // not opened yet
+            return;
+        }
         TScanCloseParams tScanCloseParams = new TScanCloseParams();
         tScanCloseParams.setContext_id(this.contextId);
-        try {
-            this.client.close_scanner(tScanCloseParams);
-        } catch (TException e) {
-            log.error("Failed to close reader {}:{} with context id {}", ip, 
port, contextId, e);
-            throw new StarRocksConnectorException(CLOSE_BE_READER_FAILED, e);
+        for (int i = 0; i < 3; i++) {
+            try {
+                this.client.close_scanner(tScanCloseParams);
+                break;
+            } catch (Exception e) {
+                log.error(
+                        "Failed to close reader {}:{} with context id {}", ip, 
port, contextId, e);
+            }
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                log.error(
+                        "Waiting for closing is interrupted, reader {}:{} with 
context id {}",
+                        ip,
+                        port,
+                        contextId);
+                throw new StarRocksConnectorException(CLOSE_BE_READER_FAILED, 
e);

Review Comment:
   ```suggestion
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to