yzeng1618 commented on code in PR #10287:
URL: https://github.com/apache/seatunnel/pull/10287#discussion_r2666845454


##########
seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/source/HbaseSourceReader.java:
##########
@@ -115,14 +129,17 @@ public void pollNext(Collector<SeaTunnelRow> output) 
throws Exception {
             final HbaseSourceSplit split = sourceSplits.poll();
             if (Objects.nonNull(split)) {
                 // read logic
-                if (currentScanner == null) {
-                    currentScanner = hbaseClient.scan(split, hbaseParameters, 
this.columnNames);
-                }
-                for (Result result : currentScanner) {
-                    SeaTunnelRow seaTunnelRow =
-                            hbaseDeserializationFormat.deserialize(
-                                    convertRawRow(result), seaTunnelRowType);
-                    output.collect(seaTunnelRow);
+                try (ResultScanner scanner =
+                        hbaseClient.scan(split, hbaseParameters, 
this.columnNames)) {
+                    currentScanner = scanner;
+                    for (Result result : scanner) {
+                        SeaTunnelRow seaTunnelRow =
+                                hbaseDeserializationFormat.deserialize(
+                                        convertRawRow(result), 
seaTunnelRowType);
+                        output.collect(seaTunnelRow);
+                    }
+                } finally {
+                    currentScanner = null;
                 }

Review Comment:
   Good catch, the currentScanner field is no longer needed, I removed it



-- 
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