refactoring

pull/2979/head
Nikita Koksharov 5 years ago
parent fe99f6deae
commit cd38c340f4

@ -354,24 +354,21 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
protected void initSingleEntry() { protected void initSingleEntry() {
try { try {
MasterSlaveEntry entry;
if (config.checkSkipSlavesInit()) { if (config.checkSkipSlavesInit()) {
entry = new SingleEntry(this, config); masterSlaveEntry = new SingleEntry(this, config);
} else { } else {
entry = new MasterSlaveEntry(this, config); masterSlaveEntry = new MasterSlaveEntry(this, config);
} }
RFuture<RedisClient> masterFuture = entry.setupMasterEntry(new RedisURI(config.getMasterAddress())); RFuture<RedisClient> masterFuture = masterSlaveEntry.setupMasterEntry(new RedisURI(config.getMasterAddress()));
masterFuture.syncUninterruptibly(); masterFuture.syncUninterruptibly();
if (!config.checkSkipSlavesInit()) { if (!config.checkSkipSlavesInit()) {
List<RFuture<Void>> fs = entry.initSlaveBalancer(getDisconnectedNodes(), masterFuture.getNow()); List<RFuture<Void>> fs = masterSlaveEntry.initSlaveBalancer(getDisconnectedNodes(), masterFuture.getNow());
for (RFuture<Void> future : fs) { for (RFuture<Void> future : fs) {
future.syncUninterruptibly(); future.syncUninterruptibly();
} }
} }
masterSlaveEntry = entry;
startDNSMonitoring(masterFuture.getNow()); startDNSMonitoring(masterFuture.getNow());
} catch (Exception e) { } catch (Exception e) {
stopThreads(); stopThreads();

Loading…
Cancel
Save