Search in sources :

Example 1 with ConfigSetMinSlavesToWrite

use of com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite in project x-pipe by ctripcorp.

the class MinSlavesRedisReadOnly method createTransactionalCommand.

private Command<?> createTransactionalCommand(int number) {
    SimpleObjectPool<NettyClient> clientPool = keyedObjectPool.getKeyPool(new InetSocketAddress(ip, port));
    ConfigSetMinSlavesToWrite configSetMinSlavesToWrite = new ConfigSetMinSlavesToWrite(null, number, scheduled);
    return new TransactionalCommand(clientPool, scheduled, configSetMinSlavesToWrite, new ConfigRewrite(null, scheduled));
}
Also used : NettyClient(com.ctrip.xpipe.netty.commands.NettyClient) ConfigRewrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigRewrite) InetSocketAddress(java.net.InetSocketAddress) ConfigSetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite) TransactionalCommand(com.ctrip.xpipe.redis.core.protocal.cmd.transaction.TransactionalCommand)

Example 2 with ConfigSetMinSlavesToWrite

use of com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite in project x-pipe by ctripcorp.

the class ConfigCommandTest method testConfigMinSlaves.

@Test
public void testConfigMinSlaves() throws InterruptedException, ExecutionException, Exception {
    InetSocketAddress address = new InetSocketAddress(ip, port);
    Integer min = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), scheduled).execute().get();
    logger.info("{}", min);
    Boolean result = new ConfigSetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), 100, scheduled).execute().get();
    logger.info("{}", result);
    min = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), scheduled).execute().get();
    logger.info("{}", min);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ConfigGetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite) ConfigSetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite) AbstractRedisTest(com.ctrip.xpipe.redis.core.AbstractRedisTest) Test(org.junit.Test)

Aggregations

ConfigSetMinSlavesToWrite (com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite)2 InetSocketAddress (java.net.InetSocketAddress)2 NettyClient (com.ctrip.xpipe.netty.commands.NettyClient)1 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 ConfigGetMinSlavesToWrite (com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite)1 ConfigRewrite (com.ctrip.xpipe.redis.core.protocal.cmd.ConfigRewrite)1 TransactionalCommand (com.ctrip.xpipe.redis.core.protocal.cmd.transaction.TransactionalCommand)1 Test (org.junit.Test)1