You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Sylvain Berthouzoz (JIRA)" <ji...@apache.org> on 2017/09/14 17:05:00 UTC

[jira] [Updated] (TOMEE-2125) Datasource config: MaxWait is ignored

     [ https://issues.apache.org/jira/browse/TOMEE-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Berthouzoz updated TOMEE-2125:
--------------------------------------
    Description: 
MaxWait Property is ignored because it will always be removed.
As example, this is my configuration in tomee.xml
{code:xml}
<Resource id="database" type="javax.sql.DataSource">
        JdbcDriver = com.mysql.jdbc.Driver
        JdbcUrl = jdbc:mysql://localhost:3306/dbname?useSSL=false
        UserName = username
        Password = somepw
        MaxActive = 20
        MaxIdle = 20
        MinIdle = 2
        InitialSize = 2
        MaxWait = 5000
        TestOnBorrow = true
        ValidationQuery = select 1
        timeBetweenEvictionRuns = 7200000
        MinEvictableIdleTimeMillis = 7200000
        TestWhileIdle = true
    </Resource>
{code}


The error is in the file {{openejb-core-7.0.3.jar!\org\apache\openejb\resource\jdbc\DataSourceFactory}} where it looks for values, instead of looking for key (line 356):

{code:java}
private static void convert(Properties properties, Duration duration, String key, String oldKey) {
        properties.remove(key);
        if(!properties.contains(oldKey)) {
            properties.remove(oldKey);
            if(duration != null) {
                if(duration.getUnit() == null) {
                    duration.setUnit(TimeUnit.MILLISECONDS);
                }

                long milliseconds = TimeUnit.MILLISECONDS.convert(duration.getTime(), duration.getUnit());
                properties.put(oldKey, String.valueOf(milliseconds));
            }
        }
    }
{code}
{{properties.contains(oldKey)}} should be replaced by {{properties.containsKey(oldKey)}}


  was:
MaxWait Property is ignored because it will always be removed.
As example, this is my configuration in tomee.xml
{code:xml}
<Resource id="database" type="javax.sql.DataSource">
        JdbcDriver = com.mysql.jdbc.Driver
        JdbcUrl = jdbc:mysql://localhost:3306/dbname?useSSL=false
        UserName = username
        Password = somepw
        MaxActive = 20
        MaxIdle = 20
        MinIdle = 2
        InitialSize = 2
        MaxWait = 5000
        TestOnBorrow = true
        ValidationQuery = select 1
        timeBetweenEvictionRuns = 7200000
        MinEvictableIdleTimeMillis = 7200000
        TestWhileIdle = true
    </Resource>
{code}


The error is in the file {{openejb-core-7.0.3.jar!\org\apache\openejb\resource\jdbc\DataSourceFactory}} where it looks for values, instead of looking for key (line 356):

{code:java}
private static void convert(Properties properties, Duration duration, String key, String oldKey) {
        properties.remove(key);
        if(!properties.contains(oldKey)) {
            properties.remove(oldKey);
            if(duration != null) {
                if(duration.getUnit() == null) {
                    duration.setUnit(TimeUnit.MILLISECONDS);
                }

                long milliseconds = TimeUnit.MILLISECONDS.convert(duration.getTime(), duration.getUnit());
                properties.put(oldKey, String.valueOf(milliseconds));
            }
        }
    }
{code}
{{properties.contains(oldKey)}} should be replaced by properties.containsKey(oldKey)



> Datasource config: MaxWait is ignored
> -------------------------------------
>
>                 Key: TOMEE-2125
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2125
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 7.0.3
>            Reporter: Sylvain Berthouzoz
>              Labels: configuration
>
> MaxWait Property is ignored because it will always be removed.
> As example, this is my configuration in tomee.xml
> {code:xml}
> <Resource id="database" type="javax.sql.DataSource">
>         JdbcDriver = com.mysql.jdbc.Driver
>         JdbcUrl = jdbc:mysql://localhost:3306/dbname?useSSL=false
>         UserName = username
>         Password = somepw
>         MaxActive = 20
>         MaxIdle = 20
>         MinIdle = 2
>         InitialSize = 2
>         MaxWait = 5000
>         TestOnBorrow = true
>         ValidationQuery = select 1
>         timeBetweenEvictionRuns = 7200000
>         MinEvictableIdleTimeMillis = 7200000
>         TestWhileIdle = true
>     </Resource>
> {code}
> The error is in the file {{openejb-core-7.0.3.jar!\org\apache\openejb\resource\jdbc\DataSourceFactory}} where it looks for values, instead of looking for key (line 356):
> {code:java}
> private static void convert(Properties properties, Duration duration, String key, String oldKey) {
>         properties.remove(key);
>         if(!properties.contains(oldKey)) {
>             properties.remove(oldKey);
>             if(duration != null) {
>                 if(duration.getUnit() == null) {
>                     duration.setUnit(TimeUnit.MILLISECONDS);
>                 }
>                 long milliseconds = TimeUnit.MILLISECONDS.convert(duration.getTime(), duration.getUnit());
>                 properties.put(oldKey, String.valueOf(milliseconds));
>             }
>         }
>     }
> {code}
> {{properties.contains(oldKey)}} should be replaced by {{properties.containsKey(oldKey)}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)