hailin0 commented on code in PR #3108:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3108#discussion_r996320201


##########
seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/source/ClickhouseSource.java:
##########
@@ -71,9 +72,10 @@ public void prepare(Config config) throws 
PrepareFailException {
                 config.getString(USERNAME), config.getString(PASSWORD));
 
         sql = config.getString(SQL);
-        try (ClickHouseClient client = 
ClickHouseClient.newInstance(servers.get(0).getProtocol());
+        ClickHouseNode currentServer = 
servers.get(threadLocalRandom.nextInt(servers.size()));

Review Comment:
   ```suggestion
           ClickHouseNode currentServer = 
servers.get(ThreadLocalRandom.current().nextInt(servers.size()));
   ```



##########
seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/source/ClickhouseSource.java:
##########
@@ -55,6 +55,7 @@ public class ClickhouseSource implements 
SeaTunnelSource<SeaTunnelRow, Clickhous
     private List<ClickHouseNode> servers;
     private SeaTunnelRowType rowTypeInfo;
     private String sql;
+    private final ThreadLocalRandom threadLocalRandom = 
ThreadLocalRandom.current();

Review Comment:
   call directly inside the method



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