Search in sources :

Example 1 with ServerHeartbeatHandler

use of com.jim.framework.rpc.keepalive.ServerHeartbeatHandler in project jim-framework by jiangmin168168.

the class RpcServerInitializer method initChannel.

@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
    // logger.info("RpcServerInitializer.initChannel");
    ChannelPipeline pipeline = socketChannel.pipeline();
    ;
    Executor executor = this.rpcThreadPoolFactory.getThreadPool(ConstantConfig.DEFAULT_THREAD_POOL_NAME).getExecutor(1, 1);
    pipeline.addLast(new RpcEncoder(RpcResponse.class)).addLast(new RpcDecoder(RpcRequest.class)).addLast(new IdleStateHandler(Constants.READER_TIME_SECONDS, 0, 0)).addLast(new ServerHeartbeatHandler()).addLast(new RpcServerInvoker(this.handlerMap, this.filterMap, executor));
}
Also used : RpcEncoder(com.jim.framework.rpc.codec.RpcEncoder) Executor(java.util.concurrent.Executor) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) ServerHeartbeatHandler(com.jim.framework.rpc.keepalive.ServerHeartbeatHandler) RpcDecoder(com.jim.framework.rpc.codec.RpcDecoder) RpcResponse(com.jim.framework.rpc.common.RpcResponse) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

RpcDecoder (com.jim.framework.rpc.codec.RpcDecoder)1 RpcEncoder (com.jim.framework.rpc.codec.RpcEncoder)1 RpcResponse (com.jim.framework.rpc.common.RpcResponse)1 ServerHeartbeatHandler (com.jim.framework.rpc.keepalive.ServerHeartbeatHandler)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 Executor (java.util.concurrent.Executor)1