use of com.ctrip.xpipe.pool.XpipeObjectPoolFromKeyed in project x-pipe by ctripcorp.
the class AbstractRedisesSlaveofJob method createSlaveofCommand.
private Command<?> createSlaveofCommand(RedisMeta redisMeta, String masterHost, int masterPort) {
SimpleObjectPool<NettyClient> pool = new XpipeObjectPoolFromKeyed<InetSocketAddress, NettyClient>(clientPool, new InetSocketAddress(redisMeta.getIp(), redisMeta.getPort()));
Command<?> command = createSlaveOfCommand(pool, masterHost, masterPort);
return CommandRetryWrapper.buildCountRetry(retryTimes, new RetryDelay(delayBaseMilli) {
@Override
public boolean retry(Throwable th) {
Throwable rootCause = ExceptionUtils.getRootCause(th);
if (rootCause instanceof RedisError) {
logger.info("[retry][do not retry, because redis error]{}", rootCause.getMessage());
return false;
}
return super.retry(th);
}
}, command, scheduled);
}
use of com.ctrip.xpipe.pool.XpipeObjectPoolFromKeyed in project x-pipe by ctripcorp.
the class KeeperStateChangeJob method createKeeperSetStateCommand.
private Command<?> createKeeperSetStateCommand(KeeperMeta keeper, Pair<String, Integer> masterAddress) {
SimpleObjectPool<NettyClient> pool = new XpipeObjectPoolFromKeyed<InetSocketAddress, NettyClient>(clientPool, new InetSocketAddress(keeper.getIp(), keeper.getPort()));
KeeperSetStateCommand command = new KeeperSetStateCommand(pool, keeper.isActive() ? KeeperState.ACTIVE : KeeperState.BACKUP, masterAddress, scheduled);
return CommandRetryWrapper.buildCountRetry(retryTimes, new RetryDelay(delayBaseMilli), command, scheduled);
}
Aggregations