Search in sources :

Example 1 with CommandHandlerManager

use of com.ctrip.xpipe.redis.keeper.handler.CommandHandlerManager 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();
}
Also used : NettyMasterHandler(com.ctrip.xpipe.redis.keeper.netty.NettyMasterHandler) SocketChannel(io.netty.channel.socket.SocketChannel) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) ServerSocketChannel(io.netty.channel.socket.ServerSocketChannel) LoggingHandler(io.netty.handler.logging.LoggingHandler) NettySimpleMessageHandler(com.ctrip.xpipe.netty.NettySimpleMessageHandler) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) XpipeRuntimeException(com.ctrip.xpipe.exception.XpipeRuntimeException) RedisSlavePromotionException(com.ctrip.xpipe.redis.keeper.exception.RedisSlavePromotionException) IOException(java.io.IOException) ChannelPipeline(io.netty.channel.ChannelPipeline) CommandHandlerManager(com.ctrip.xpipe.redis.keeper.handler.CommandHandlerManager)

Aggregations

XpipeRuntimeException (com.ctrip.xpipe.exception.XpipeRuntimeException)1 NettySimpleMessageHandler (com.ctrip.xpipe.netty.NettySimpleMessageHandler)1 RedisSlavePromotionException (com.ctrip.xpipe.redis.keeper.exception.RedisSlavePromotionException)1 CommandHandlerManager (com.ctrip.xpipe.redis.keeper.handler.CommandHandlerManager)1 NettyMasterHandler (com.ctrip.xpipe.redis.keeper.netty.NettyMasterHandler)1 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 ServerSocketChannel (io.netty.channel.socket.ServerSocketChannel)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1 LoggingHandler (io.netty.handler.logging.LoggingHandler)1 IOException (java.io.IOException)1