关于im-server启动代码的一个问题

tpuser12 28天前 115

protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(new HttpRequestDecoder()); socketChannel.pipeline().addLast(new HttpResponseEncoder()); socketChannel.pipeline().addLast(new ChunkedWriteHandler()); socketChannel.pipeline().addLast(new HttpObjectAggregator(100 1024 1024)); socketChannel.pipeline().addLast(new IMActionHandler(messagesStore, sessionsStore)); }

这是im-server启动的一段代码,最后一行代码 socketChannel.pipeline().addLast(new IMActionHandler(messagesStore, sessionsStore)); 这样写是不是有可能导致work线程阻塞?因为IMActionHandler的处理逻辑是同步的,而不是异步的。

最新回复 (1)
  • tpuser12 28天前
    引用 2
    protected void initChannel(SocketChannel socketChannel) throws Exception {
                            socketChannel.pipeline().addLast(new HttpRequestDecoder());
                            socketChannel.pipeline().addLast(new HttpResponseEncoder());
                            socketChannel.pipeline().addLast(new ChunkedWriteHandler());
                            socketChannel.pipeline().addLast(new HttpObjectAggregator(100 * 1024 * 1024));
                            socketChannel.pipeline().addLast(new IMActionHandler(messagesStore, sessionsStore));
                                           }

    上面的格式变形了,重新发了一下代码
返回