MINA
  1. MINA
  2. DIRMINA-723

OrderedThreadPoolExecutor behavior: configurable queue size, corePoolSize, maximumPoolSize

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0-M6
    • Fix Version/s: 2.0.8
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Ubuntu Linux, kernel 2.6.x

      Description

      The problem was discussed with Emmanuel Lecharny in mail lists:
      http://www.nabble.com/OrderedThreadPoolExecutor%3A-limited-workQueue-td24275973.html

      If you compare OrderedThreadPoolExecutor and standard ThreadPoolExecutor, you can see that ThreadPoolExecutor has useful params:

      • core pool size
      • maximum pool size
      • work queue size

      If you use unbounded thread pools and queues with mina Acceptor or Connector, you may get OutOfMemoryError under critical load because Java creates too many threads.
      With ThreadPoolExecutor you may limit the number of threads (maximumPoolSize) and use a bounded queue (ex. LinkedBlockingQueue of limited capacity).
      Unfortunately, this does not work with OrderedThreadPoolExecutor -both "waitingSessions" and "sessionTasksQueue" do not allow to configure their size nor pass a different queue implementation.

      Even though OrderedThreadPoolExecutor extends ThreadPoolExecutor, it overrides the behavior significantly - seems that its meaning of "corePoolSize" and "maximumPoolSize" is different.

        Activity

        Hide
        Emmanuel Lecharny added a comment -

        What if you use a IoEventQueueThrottle ? This allows you to limit the number of events the queue can contains.

        Show
        Emmanuel Lecharny added a comment - What if you use a IoEventQueueThrottle ? This allows you to limit the number of events the queue can contains.

          People

          • Assignee:
            Unassigned
            Reporter:
            Victor N
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development