Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-1088

OrderedThreadPool implementation should be compatible with Java 10

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.20
    • Component/s: Core
    • Labels:
      None

      Description

      org.apache.mina.filter.executor.OrderedThreadPoolExecutor inherits from java.util.concurrent.ThreadPoolExecutor

      OrderedThreadPoolExecutor, in its constructor, calls these two methods from its parent to determine pool sizing:

       super.setCorePoolSize(corePoolSize);
       super.setMaximumPoolSize(maximumPoolSize);

      This works fine up until Java 8. In Java 10 (possibly 9 - I did not check), an additional input validation was added to ThreadPoolExecutor#setCorePoolSize: maximumPoolSize < corePoolSize

      ThreadPoolExecutor Java 8:

          public void setCorePoolSize(int corePoolSize) {
              if (corePoolSize < 0)
                  throw new IllegalArgumentException();
      
          public void setMaximumPoolSize(int maximumPoolSize) {
              if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize)
                  throw new IllegalArgumentException();
      

      ThreadPoolExecutor Java 10:

          public void setCorePoolSize(int corePoolSize) {
              if (corePoolSize < 0 || maximumPoolSize < corePoolSize)
                  throw new IllegalArgumentException();
      
      
          public void setMaximumPoolSize(int maximumPoolSize) {
              if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize)
                  throw new IllegalArgumentException();
      

      As a result, the first line of this part of the constructor of OrderedThreadPoolExecutor now throws an IllegalArgumentException.

       super.setCorePoolSize(corePoolSize);
       super.setMaximumPoolSize(maximumPoolSize);

        Attachments

        1. orderedthreadpool.patch
          1 kB
          Guus der Kinderen

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                guus.der.kinderen Guus der Kinderen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: