use of com.ctrip.xpipe.netty.commands.DefaultNettyClient in project x-pipe by ctripcorp.
the class AbstractRedisMasterReplication method masterConnected.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void masterConnected(Channel channel) {
connectedTime = System.currentTimeMillis();
this.masterChannel = channel;
clientPool = new FixedObjectPool<NettyClient>(new DefaultNettyClient(channel));
checkTimeout(channel);
checkKeeper();
SequenceCommandChain chain = new SequenceCommandChain(false);
chain.add(listeningPortCommand());
chain.add(new FailSafeCommandWrapper<>(new Replconf(clientPool, ReplConfType.CAPA, scheduled, CAPA.EOF.toString(), CAPA.PSYNC2.toString())));
try {
executeCommand(chain).addListener(new CommandFutureListener() {
@Override
public void operationComplete(CommandFuture commandFuture) throws Exception {
if (commandFuture.isSuccess()) {
sendReplicationCommand();
} else {
logger.error("[operationComplete][listeningPortCommand]", commandFuture.cause());
}
}
});
} catch (Exception e) {
logger.error("[masterConnected]" + channel, e);
}
}
Aggregations