Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1168112049


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm 
implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String 
writeDataSourceName, final List<String> readDataSourceNames) {
-        return 
readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data 
need at least 1 source.");

Review Comment:
   Please use `ShardingSpherePreconditions` to replace `Preconditions`.



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