use of com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool in project x-pipe by ctripcorp.
the class ConsoleContextConfig method getClientPool.
@Bean
public XpipeNettyClientKeyedObjectPool getClientPool() throws Exception {
XpipeNettyClientKeyedObjectPool keyedObjectPool = new XpipeNettyClientKeyedObjectPool();
keyedObjectPool.initialize();
keyedObjectPool.start();
return keyedObjectPool;
}
use of com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool in project x-pipe by ctripcorp.
the class AbstractRedisCommandTest method testLogRequest.
// manual test
@Test
public void testLogRequest() throws Exception {
XpipeNettyClientKeyedObjectPool keyedObjectPool = getXpipeNettyClientKeyedObjectPool();
SimpleObjectPool<NettyClient> clientPool = keyedObjectPool.getKeyPool(new InetSocketAddress("127.0.0.1", 6379));
ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1);
InfoCommand infoCommand = new InfoCommand(clientPool, InfoCommand.INFO_TYPE.REPLICATION, scheduled);
infoCommand.logResponse(false);
// infoCommand.logRequest(false);
infoCommand.execute().get();
}
use of com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool in project x-pipe by ctripcorp.
the class AbstractTest method getXpipeNettyClientKeyedObjectPool.
protected XpipeNettyClientKeyedObjectPool getXpipeNettyClientKeyedObjectPool() throws Exception {
XpipeNettyClientKeyedObjectPool result;
try {
result = getBean(XpipeNettyClientKeyedObjectPool.class);
} catch (Exception e) {
result = new XpipeNettyClientKeyedObjectPool();
add(result);
}
LifecycleHelper.initializeIfPossible(result);
LifecycleHelper.startIfPossible(result);
return result;
}
use of com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool in project x-pipe by ctripcorp.
the class TransactionalSlaveOfCommandTest method testXslaveof.
@SuppressWarnings("deprecation")
@Test
public void testXslaveof() throws Exception {
XpipeNettyClientKeyedObjectPool pool = getXpipeNettyClientKeyedObjectPool();
for (int i = 0; i < testCount; i++) {
logger.info(remarkableMessage("{}"), i);
TransactionalSlaveOfCommand command = new TransactionalSlaveOfCommand(getXpipeNettyClientKeyedObjectPool().getKeyPool(new InetSocketAddress(ip, port)), ip, port, scheduled);
Object[] result = command.execute().get();
logger.info("{}", (Object) result);
Assert.assertEquals(0, pool.getObjectPool().getNumActive());
Assert.assertEquals(1, pool.getObjectPool().getNumIdle());
}
}
Aggregations