You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Guus der Kinderen (JIRA)" <ji...@apache.org> on 2018/06/29 14:36:02 UTC

[jira] [Updated] (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:all-tabpanel ]

Guus der Kinderen updated DIRMINA-1088:
---------------------------------------
    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:

{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}


  was:
{{org.apache.mina.filter.executor.OrderedThreadPoolExecutor}} inherits from {{java.util.concurrent.ThreadPoolExecutor}}

OrderedThreadPool, 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 OrderedThreadPool now throws an IllegalArgumentException.

{code:java}
 super.setCorePoolSize(corePoolSize);
 super.setMaximumPoolSize(maximumPoolSize);{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
>
> {{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)