Search in sources :

Example 1 with SetMessageHandler

use of com.ctrip.xpipe.redis.keeper.simple.latency.netty.SetMessageHandler in project x-pipe by ctripcorp.

the class PsyncLatencyTest method startSendMessage.

private void startSendMessage() {
    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 SetMessageHandler(PsyncLatencyTest.this));
        }
    });
    b.connect(master);
}
Also used : NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) LoggingHandler(io.netty.handler.logging.LoggingHandler) EventLoopGroup(io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) SetMessageHandler(com.ctrip.xpipe.redis.keeper.simple.latency.netty.SetMessageHandler) Bootstrap(io.netty.bootstrap.Bootstrap) NettySimpleMessageHandler(com.ctrip.xpipe.netty.NettySimpleMessageHandler) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

NettySimpleMessageHandler (com.ctrip.xpipe.netty.NettySimpleMessageHandler)1 SetMessageHandler (com.ctrip.xpipe.redis.keeper.simple.latency.netty.SetMessageHandler)1 Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)1 LoggingHandler (io.netty.handler.logging.LoggingHandler)1