use of com.ctrip.xpipe.api.endpoint.Endpoint in project x-pipe by ctripcorp.
the class RoleCommandHandler method doHandle.
@Override
protected void doHandle(String[] args, RedisClient redisClient) {
RedisKeeperServer redisKeeperServer = redisClient.getRedisKeeperServer();
ReplicationStore replicationStore = redisKeeperServer.getReplicationStore();
RedisMaster redisMaster = redisKeeperServer.getRedisMaster();
Endpoint masterEndPoint = null;
if (redisMaster != null) {
masterEndPoint = redisMaster.masterEndPoint();
}
Object[] result = new Object[5];
result[0] = redisKeeperServer.role().toString();
result[1] = masterEndPoint == null ? "0.0.0.0" : masterEndPoint.getHost();
result[2] = masterEndPoint == null ? "0" : masterEndPoint.getPort();
result[3] = redisMaster == null ? MASTER_STATE.REDIS_REPL_NONE.getDesc() : redisMaster.getMasterState().getDesc();
result[4] = replicationStore == null ? -1L : replicationStore.getEndOffset();
redisClient.sendMessage(ParserManager.parse(result));
}
Aggregations