use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class XpipeNettyClientPool method doInitialize.
@Override
protected void doInitialize() throws Exception {
this.factory = new NettyClientFactory(target);
this.factory.start();
GenericObjectPool<NettyClient> genericObjectPool = new GenericObjectPool<>(factory, config);
genericObjectPool.setTestOnBorrow(true);
genericObjectPool.setTestOnCreate(true);
this.objectPool = genericObjectPool;
}
use of com.ctrip.xpipe.netty.commands.NettyClient in project x-pipe by ctripcorp.
the class PsyncTest method beforePsyncTest.
@Before
public void beforePsyncTest() throws Exception {
masterOffset = (long) randomInt(0, Integer.MAX_VALUE - 1);
replicationStoreManager = createReplicationStoreManager();
LifecycleHelper.initializeIfPossible(replicationStoreManager);
replicationStore = (DefaultReplicationStore) replicationStoreManager.create();
SimpleObjectPool<NettyClient> clientPool = NettyPoolUtil.createNettyPool(new InetSocketAddress("127.0.0.1", 1234));
psync = new DefaultPsync(clientPool, new DefaultEndPoint("127.0.0.1", 1234), replicationStoreManager, scheduled);
psync.future().addListener(new CommandFutureListener<Object>() {
@Override
public void operationComplete(CommandFuture<Object> commandFuture) throws Exception {
if (!commandFuture.isSuccess()) {
logger.error("[operationComplete]", commandFuture.cause());
}
}
});
}
Aggregations