use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class XRedisXpipeCommandTest method getSyncFull.
private Integer getSyncFull(RedisMeta redis) throws Exception {
SimpleObjectPool<NettyClient> keyPool = getXpipeNettyClientKeyedObjectPool().getKeyPool(new InetSocketAddress(redis.getIp(), redis.getPort()));
InfoCommand infoCommand = new InfoCommand(keyPool, InfoCommand.INFO_TYPE.STATS, scheduled);
String value = infoCommand.execute().get();
Integer sync_full = new InfoResultExtractor(value).extractAsInteger("sync_full");
return sync_full;
}
use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class RedisSlaveReplAllTest method makeSlaveReplAll.
public void makeSlaveReplAll(RedisMeta slave, boolean replAll) throws Exception {
SimpleObjectPool<NettyClient> keyPool = getXpipeNettyClientKeyedObjectPool().getKeyPool(new InetSocketAddress(slave.getIp(), slave.getPort()));
ConfigSetCommand.ConfigSetReplAll configSetReplAll = new ConfigSetCommand.ConfigSetReplAll(replAll, keyPool, scheduled);
configSetReplAll.execute().get();
}
use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class DefaultSentinelManager method getMasterOfMonitor.
@Override
public HostPort getMasterOfMonitor(Sentinel sentinel, String sentinelMonitorName) {
SimpleObjectPool<NettyClient> clientPool = keyedClientPool.getKeyPool(new InetSocketAddress(sentinel.getIp(), sentinel.getPort()));
AbstractSentinelCommand.SentinelMaster sentinelMaster = new AbstractSentinelCommand.SentinelMaster(clientPool, scheduled, sentinelMonitorName);
sentinelMaster.logResponse(false);
HostPort result = null;
try {
result = sentinelMaster.execute().get();
logger.info("[getMasterOfMonitor]getMasterOfMonitor {} from {} : {}", sentinelMonitorName, sentinel, result);
} catch (Exception e) {
logger.error("[getMasterOfMonitor] {} from {} : {}", sentinelMonitorName, sentinel, e.getMessage());
}
return result;
}
use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class DefaultSentinelManager method removeSentinelMonitor.
@Override
public void removeSentinelMonitor(Sentinel sentinel, String sentinelMonitorName) {
SimpleObjectPool<NettyClient> clientPool = keyedClientPool.getKeyPool(new InetSocketAddress(sentinel.getIp(), sentinel.getPort()));
AbstractSentinelCommand.SentinelRemove sentinelRemove = new AbstractSentinelCommand.SentinelRemove(clientPool, sentinelMonitorName, scheduled);
try {
String result = sentinelRemove.execute().get();
logger.info("[removeSentinels]removeSentinelMonitor {} from {} : {}", sentinelMonitorName, sentinel, result);
} catch (Exception e) {
logger.error("removeSentinelMonitor {} from {} : {}", sentinelMonitorName, sentinel, e.getMessage());
}
}
use of com.ctrip.xpipe.netty.commands.NettyClient 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);
}
Aggregations