[jira] [Commented] (DIRMINA-1088) OrderedThreadPool implementation should be compatible with Java 10
[ https://issues.apache.org/jira/browse/DIRMINA-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16562352#comment-16562352 ] Emmanuel Lecharny commented on DIRMINA-1088: Patch applied to 2.1.0 too. > OrderedThreadPool implementation should be compatible with Java 10 > -- > > Key: DIRMINA-1088 > URL: https://issues.apache.org/jira/browse/DIRMINA-1088 > Project: MINA > Issue Type: Bug > Components: Core >Reporter: Guus der Kinderen >Priority: Major > Attachments: orderedthreadpool.patch > > > {{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: > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} > 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: > {code:java} > public void setCorePoolSize(int corePoolSize) { > if (corePoolSize < 0) > throw new IllegalArgumentException(); > public void setMaximumPoolSize(int maximumPoolSize) { > if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) > throw new IllegalArgumentException(); > {code} > ThreadPoolExecutor Java 10: > {code:java} > 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(); > {code} > As a result, the first line of this part of the constructor of > OrderedThreadPoolExecutor now throws an IllegalArgumentException. > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (DIRMINA-1088) OrderedThreadPool implementation should be compatible with Java 10
[ https://issues.apache.org/jira/browse/DIRMINA-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16555606#comment-16555606 ] Guus der Kinderen commented on DIRMINA-1088: [~elecharny], would you mind applying the same change to https://git1-us-west.apache.org/repos/asf?p=mina.git;a=blob;f=mina-core/src/main/java/org/apache/mina/filter/executor/PriorityThreadPoolExecutor.java;h=dd6b6e140f2ed953efbb291a0410a7a37f691aa0;hb=56ca189e1b2de1b6d9ab3635dd8f331f13762009 which got introduced as part of DIRMINA-1078? > OrderedThreadPool implementation should be compatible with Java 10 > -- > > Key: DIRMINA-1088 > URL: https://issues.apache.org/jira/browse/DIRMINA-1088 > Project: MINA > Issue Type: Bug > Components: Core >Reporter: Guus der Kinderen >Priority: Major > Attachments: orderedthreadpool.patch > > > {{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: > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} > 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: > {code:java} > public void setCorePoolSize(int corePoolSize) { > if (corePoolSize < 0) > throw new IllegalArgumentException(); > public void setMaximumPoolSize(int maximumPoolSize) { > if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) > throw new IllegalArgumentException(); > {code} > ThreadPoolExecutor Java 10: > {code:java} > 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(); > {code} > As a result, the first line of this part of the constructor of > OrderedThreadPoolExecutor now throws an IllegalArgumentException. > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (DIRMINA-1088) OrderedThreadPool implementation should be compatible with Java 10
[ https://issues.apache.org/jira/browse/DIRMINA-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529012#comment-16529012 ] Emmanuel Lecharny commented on DIRMINA-1088: Hi Guss, you are right . Not setting the {{maximumPoolSize}} *before* setting the {{corePoolSize}} will lead to an error in Java 10. I have applied your patch. FTR, I also fixed a small mistake in the previous line : {code:java} if ((maximumPoolSize == 0) || (maximumPoolSize < corePoolSize)) { throw new IllegalArgumentException("maximumPoolSize: " + maximumPoolSize); } {code} should be : {code:java} if ((maximumPoolSize <= 0) || (maximumPoolSize < corePoolSize)) { throw new IllegalArgumentException("maximumPoolSize: " + maximumPoolSize); } {code} (the {{ThreadPoolExecutor.setMaximumPoolSize()}} method expect the {{maximumPoolSize}} to be stricly positive : {code:java} public void setMaximumPoolSize(int maximumPoolSize) { if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) throw new IllegalArgumentException(); ... {code} > OrderedThreadPool implementation should be compatible with Java 10 > -- > > Key: DIRMINA-1088 > URL: https://issues.apache.org/jira/browse/DIRMINA-1088 > Project: MINA > Issue Type: Bug > Components: Core >Reporter: Guus der Kinderen >Priority: Major > Attachments: orderedthreadpool.patch > > > {{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: > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} > 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: > {code:java} > public void setCorePoolSize(int corePoolSize) { > if (corePoolSize < 0) > throw new IllegalArgumentException(); > public void setMaximumPoolSize(int maximumPoolSize) { > if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) > throw new IllegalArgumentException(); > {code} > ThreadPoolExecutor Java 10: > {code:java} > 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(); > {code} > As a result, the first line of this part of the constructor of > OrderedThreadPoolExecutor now throws an IllegalArgumentException. > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (DIRMINA-1088) OrderedThreadPool implementation should be compatible with Java 10
[ https://issues.apache.org/jira/browse/DIRMINA-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527732#comment-16527732 ] Guus der Kinderen commented on DIRMINA-1088: I think the problem is resolved by setting Max before Core. That should have negligible side-effects otherwise. I've attached a patch to this issue. > OrderedThreadPool implementation should be compatible with Java 10 > -- > > Key: DIRMINA-1088 > URL: https://issues.apache.org/jira/browse/DIRMINA-1088 > Project: MINA > Issue Type: Bug > Components: Core >Reporter: Guus der Kinderen >Priority: Major > Attachments: orderedthreadpool.patch > > > {{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: > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} > 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: > {code:java} > public void setCorePoolSize(int corePoolSize) { > if (corePoolSize < 0) > throw new IllegalArgumentException(); > public void setMaximumPoolSize(int maximumPoolSize) { > if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) > throw new IllegalArgumentException(); > {code} > ThreadPoolExecutor Java 10: > {code:java} > 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(); > {code} > As a result, the first line of this part of the constructor of > OrderedThreadPoolExecutor now throws an IllegalArgumentException. > {code:java} > super.setCorePoolSize(corePoolSize); > super.setMaximumPoolSize(maximumPoolSize);{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)