use of com.ctrip.xpipe.command.UntilSuccess in project x-pipe by ctripcorp.
the class DefaultSlaveOfCommand method doExecute.
@Override
protected void doExecute() throws CommandExecutionException {
SimpleObjectPool<NettyClient> clientPool = getClientPool();
UntilSuccess slaveOf = new UntilSuccess();
slaveOf.add(new XSlaveofCommand(clientPool, ip, port, scheduled));
slaveOf.add(new SlaveOfCommand(clientPool, ip, port, scheduled));
SequenceCommandChain chain = new SequenceCommandChain(false);
chain.add(slaveOf);
chain.add(new ConfigRewrite(clientPool, scheduled));
chain.execute().addListener(new CommandFutureListener<Object>() {
@Override
public void operationComplete(CommandFuture<Object> commandFuture) throws Exception {
if (commandFuture.isSuccess()) {
future().setSuccess(RedisClientProtocol.OK);
} else {
future().setFailure(commandFuture.cause());
}
}
});
}
Aggregations