提交 60bf7631 编写于 作者: wu-sheng's avatar wu-sheng

补充提交,修复unusedServerAddresses的数量小于1的情况,防止unusedServerAddresses.size为0时,连接巡检线程异常。

上级 0f1c27e6
...@@ -134,4 +134,12 @@ ...@@ -134,4 +134,12 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<distributionManagement>
<snapshotRepository>
<id>company-private-nexus-library-snapshots</id>
<name>company-private-nexus-library-snapshots</name>
<url>http://10.1.228.199:18081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project> </project>
...@@ -135,7 +135,7 @@ public class DataSenderFactoryWithBalance { ...@@ -135,7 +135,7 @@ public class DataSenderFactoryWithBalance {
} }
// try to fill up senders. if size is not enough. // try to fill up senders. if size is not enough.
while (usingDataSender.size() < maxKeepConnectingSenderSize) { while (unusedServerAddresses.size() > 0 && usingDataSender.size() < maxKeepConnectingSenderSize) {
if ((newSender = findReadySender()) == null) { if ((newSender = findReadySender()) == null) {
// no available sender. ignore. // no available sender. ignore.
break; break;
...@@ -145,7 +145,7 @@ public class DataSenderFactoryWithBalance { ...@@ -145,7 +145,7 @@ public class DataSenderFactoryWithBalance {
} }
// try to switch. // try to switch.
if (sleepTime >= SWITCH_SENDER_INTERVAL) { if (sleepTime >= SWITCH_SENDER_INTERVAL && unusedServerAddresses.size() > 0) {
// if sender is enough, go to switch for balancing. // if sender is enough, go to switch for balancing.
if (usingDataSender.size() >= maxKeepConnectingSenderSize) { if (usingDataSender.size() >= maxKeepConnectingSenderSize) {
DataSender toBeSwitchSender; DataSender toBeSwitchSender;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册