【问题标题】:Difference between OrderedMemoryAwareThreadPoolExecutor and MemoryAwareThreadPoolExecutor in nettynetty中OrderedMemoryAwareThreadPoolExecutor和MemoryAwareThreadPoolExecutor的区别
【发布时间】:2015-02-18 03:24:12
【问题描述】:

在编写 netty 应用程序时,我不确定应该为管道处理程序使用哪个线程池。

要么我应该去

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

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

不确定两者之间的区别。

任何帮助将不胜感激。

【问题讨论】:

    标签: java netty nms


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-11
      • 2018-11-10
      • 2017-08-04
      • 2022-01-21
      • 1970-01-01
      • 2011-08-08
      • 2015-01-21
      • 2017-11-16
      相关资源
      最近更新 更多