1. 修复unusedServerAddresses的数量小于等于1的情况,使用ThreadLocalRandom会抛出异常
This commit is contained in:
parent
8f01480b95
commit
2e8425117c
|
|
@ -197,8 +197,14 @@ public class DataSenderFactoryWithBalance {
|
|||
private static DataSender findReadySender() {
|
||||
|
||||
DataSender result = null;
|
||||
int index = ThreadLocalRandom.current().nextInt(0,
|
||||
unusedServerAddresses.size());
|
||||
|
||||
int index = 0;
|
||||
|
||||
if (unusedServerAddresses.size() > 1){
|
||||
index = ThreadLocalRandom.current().nextInt(0,
|
||||
unusedServerAddresses.size());
|
||||
}
|
||||
|
||||
for (int i = 0; i < unusedServerAddresses.size(); i++, index++) {
|
||||
|
||||
if (index == unusedServerAddresses.size()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue