0

While writing netty application I am not sure to which thread pool should i use for my pipeline handler.

either I should go with

// OrderedMemoryAwareThreadPoolExecutor impl
    OrderedMemoryAwareThreadPoolExecutor pipelineExecutor = new OrderedMemoryAwareThreadPoolExecutor(
            200, 1048576, 1073741824, 100, TimeUnit.MILLISECONDS,
            new NioDataSizeEstimator(), new NioThreadFactory("NioPipeline"));

or

 ThreadPoolExecutor pool = new MemoryAwareThreadPoolExecutor(
     16, 65536, 1048576, 30, TimeUnit.SECONDS,
     new MyObjectSizeEstimator(),
     Executors.defaultThreadFactory());

Not sure about the difference between two.

Any help would be appreciated.

4

1 回答 1

1

我认为从 javadocs 开始就很清楚了。OrderedMemoryAwareThreadPoolExecutor 将确保事件按“顺序”为 Channel 执行,而 MemoryAwareThreadPoolExecutor 不会。

于 2015-02-17T19:24:12.640 回答