use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.
the class NettyKeyedPoolClientFactory method doStart.
@Override
protected void doStart() throws Exception {
eventLoopGroup = new NioEventLoopGroup(eventLoopThreads, XpipeThreadFactory.create("NettyKeyedPoolClientFactory"));
b.group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler());
p.addLast(new NettySimpleMessageHandler());
p.addLast(new NettyClientHandler());
}
});
}
use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.
the class PsyncLatencyTest method startGetLatency.
private void startGetLatency() {
EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
Bootstrap b = new Bootstrap();
b.group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler(LogLevel.DEBUG));
p.addLast(new NettySimpleMessageHandler());
p.addLast(new ReceiveMessageHandler(runId, offset));
}
});
b.connect(dest);
}
use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.
the class DefaultRedisKeeperServer method startServer.
protected void startServer() throws InterruptedException {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).handler(new LoggingHandler(LogLevel.INFO)).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler(LogLevel.DEBUG));
p.addLast(new NettySimpleMessageHandler());
p.addLast(new NettyMasterHandler(DefaultRedisKeeperServer.this, new CommandHandlerManager(), keeperConfig.getTrafficReportIntervalMillis()));
}
});
serverSocketChannel = (ServerSocketChannel) b.bind(currentKeeperMeta.getPort()).sync().channel();
}
use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.
the class NettyClientFactory method doStart.
@Override
protected void doStart() throws Exception {
eventLoopGroup = new NioEventLoopGroup(1);
b.group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler());
p.addLast(new NettySimpleMessageHandler());
p.addLast(new NettyClientHandler());
}
});
}
use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.
the class AbstractRedisMasterReplication method connectWithMaster.
protected void connectWithMaster() {
if (!(getLifecycleState().isStarting() || getLifecycleState().isStarted())) {
logger.info("[connectWithMaster][do not connect, is stopped!!]{}", redisMaster.masterEndPoint());
return;
}
Bootstrap b = new Bootstrap();
b.group(nioEventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT).handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler(LogLevel.DEBUG));
p.addLast(new NettySimpleMessageHandler());
p.addLast(createHandler());
}
});
doConnect(b);
}
Aggregations