Set connection to fail when all slaves init connections error

Signed-off-by: Yann <zhouyanbin1029@gmail.com>
pull/3355/head
Yann 4 years ago
parent 449f056314
commit 71ce9730ac

@ -313,11 +313,16 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
if (!config.checkSkipSlavesInit()) {
List<RFuture<Void>> fs = entry.initSlaveBalancer(partition.getFailedSlaveAddresses(), masterClient);
AtomicInteger counter = new AtomicInteger(fs.size());
AtomicInteger errorCounter = new AtomicInteger(fs.size());
for (RFuture<Void> future : fs) {
future.onComplete((r, ex) -> {
if (ex != null) {
log.error("unable to add slave for: " + partition.getMasterAddress()
+ " slot ranges: " + partition.getSlotRanges(), ex);
if (errorCounter.decrementAndGet() == 0) {
result.tryFailure(ex);
return;
}
}
if (counter.decrementAndGet() == 0) {

Loading…
Cancel
Save