【发布时间】:2012-08-02 09:45:11
【问题描述】:
也许这是一个显而易见的问题,但我对 netty 太陌生了。
查看 HttpChunckAggregator 类,我发现它是有状态的。这让我怀疑......给定一个具有以下管道的特定频道:
private MyServerHandler handler;
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = pipeline();
pipeline.addLast("decoder",new HttpRequestDecoder());
pipeline.addLast("chunkAggregator",new HttpChunkAggregator(4194304));
pipeline.addLast("encoder",new HttpResponseEncoder());
pipeline.addLast("chunkSeparator",new HttpChunkSeparator(4194304));
pipeline.addLast("handler", handler); //Singleton
return pipeline;
}
还有一个 NIO Netty 服务器,我可以在分块消息和多线程的情况下获得竞争条件吗?
我看到每个新频道都会创建一个新的块聚合器,但是......所有的块消息都将在同一个频道中接收?
【问题讨论】:
标签: netty http-chunked