use of com.ctrip.xpipe.redis.keeper.CommandHandler in project x-pipe by ctripcorp.
the class CommandHandlerManager method doHandle.
@Override
protected void doHandle(final String[] args, final RedisClient redisClient) {
if (args.length == 0) {
logger.error("[doHandle][arg length]{}", redisClient);
return;
}
redisClient.getRedisKeeperServer().processCommandSequentially(new Runnable() {
@Override
public void run() {
try {
CommandHandler handler = handlers.get(args[0].toLowerCase());
if (handler == null) {
logger.error("[doHandler][no handler found]{}, {}", redisClient, StringUtil.join(" ", args));
redisClient.sendMessage(new RedisErrorParser("unsupported command:" + args[0]).format());
return;
}
innerDoHandle(args, redisClient, handler);
} catch (Exception e) {
logger.error("Error process command {} for client {}", Arrays.asList(args), redisClient, e);
redisClient.sendMessage(new RedisErrorParser(e.getMessage()).format());
}
}
@Override
public String toString() {
return String.format("%s, %s", redisClient, StringUtil.join(" ", args));
}
});
}
Aggregations