@Test public void testChooseNoMaster() throws Exception { redis1Master = false; redis2Master = false; RedisMeta redisMeta = chooseCommand.choose(); Assert.assertNull(redisMeta); }
@Override public RedisMeta choose() throws Exception { List<RedisMeta> redisMasters = getMasters(allRedises); if (isMasterExactOne(redisMasters)) { RedisMeta peerMaster = redisMasters.get(0); peerMaster.setGid(getRedisGid(peerMaster.getIp(), peerMaster.getPort())); return peerMaster; } else { getLogger().info("[choose] unexpected master size {} for {}, {}, masters: {}", redisMasters.size(), clusterId, shardId, redisMasters); } return null; }
CurrentMasterChooseCommand extends AbstractMasterChooseCommand { @Override public RedisMeta choose() throws Exception { List<RedisMeta> redisMasters = getMasters(allRedises); if (isMasterExactOne(redisMasters)) { RedisMeta peerMaster = redisMasters.get(0); peerMaster.setGid(getRedisGid(peerMaster.getIp(), peerMaster.getPort())); return peerMaster; } else { getLogger().info("[choose] unexpected master size {} for {}, {}, masters: {}", redisMasters.size(), clusterId, shardId, redisMasters); } return null; } }
CurrentMasterChooseCommand extends AbstractMasterChooseCommand { @Override public RedisMeta choose() throws Exception { List<RedisMeta> redisMasters = getMasters(allRedises); if (isMasterExactOne(redisMasters)) { RedisMeta peerMaster = redisMasters.get(0); peerMaster.setGid(getRedisGid(peerMaster.getIp(), peerMaster.getPort())); return peerMaster; } else { getLogger().info("[choose] unexpected master size {} for {}, {}, masters: {}", redisMasters.size(), clusterId, shardId, redisMasters); } return null; } CurrentMasterChooseCommand(String clusterId, String shardId, List<RedisMeta> allRedises, ScheduledExecutorService scheduled,
                                      XpipeNettyClientKeyedObjectPool keyedObjectPool, int checkRedisTimeoutSeconds); }
CurrentMasterChooseCommand extends AbstractMasterChooseCommand { @Override public RedisMeta choose() throws Exception { List<RedisMeta> redisMasters = getMasters(allRedises); if (isMasterExactOne(redisMasters)) { RedisMeta peerMaster = redisMasters.get(0); peerMaster.setGid(getRedisGid(peerMaster.getIp(), peerMaster.getPort())); return peerMaster; } else { getLogger().info("[choose] unexpected master size {} for {}, {}, masters: {}", redisMasters.size(), clusterId, shardId, redisMasters); } return null; } CurrentMasterChooseCommand(String clusterId, String shardId, List<RedisMeta> allRedises, ScheduledExecutorService scheduled,
                                      XpipeNettyClientKeyedObjectPool keyedObjectPool, int checkRedisTimeoutSeconds); @Override RedisMeta choose(); }
CurrentMasterChooseCommand extends AbstractMasterChooseCommand { @Override public RedisMeta choose() throws Exception { List<RedisMeta> redisMasters = getMasters(allRedises); if (isMasterExactOne(redisMasters)) { RedisMeta peerMaster = redisMasters.get(0); peerMaster.setGid(getRedisGid(peerMaster.getIp(), peerMaster.getPort())); return peerMaster; } else { getLogger().info("[choose] unexpected master size {} for {}, {}, masters: {}", redisMasters.size(), clusterId, shardId, redisMasters); } return null; } CurrentMasterChooseCommand(String clusterId, String shardId, List<RedisMeta> allRedises, ScheduledExecutorService scheduled,
                                      XpipeNettyClientKeyedObjectPool keyedObjectPool, int checkRedisTimeoutSeconds); @Override RedisMeta choose();  }