commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael C (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POOL-338) GenericObjectPool constructor throws an exception
Date Tue, 10 Apr 2018 00:25:00 GMT

    [ https://issues.apache.org/jira/browse/POOL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16431549#comment-16431549
] 

Michael C commented on POOL-338:
--------------------------------

Your diff won't help my use case of calling default constructor {{GenericObjectPool()}}. See
the original stack trace. It is not the class loader that throws the exception. It is the
{{if (policy instanceof EvictionPolicy<?>)}} line evaluates to false for whatever odd
reason.

Nice addition to the 2.6 API, but consider adding:

{{    BaseObjectPoolConfig.setEvictionPolicy(EvictionPolicy<T> evictionPolicy)}}
{{    BaseObjectPoolConfig.getEvictionPolicy()}}

plus the logic that favors a not null {{evictionPolicy}} over {{evictionPolicyClassName}}.

> GenericObjectPool constructor throws an exception
> -------------------------------------------------
>
>                 Key: POOL-338
>                 URL: https://issues.apache.org/jira/browse/POOL-338
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.4.2, 2.4.3, 2.5.0
>         Environment: Java 8, Liferay DXP (an OSGi environment).
>            Reporter: Michael C
>            Priority: Major
>
> Version 2.4.3 GenericObjectPool constructor throws this exception:
> {{java.lang.IllegalArgumentException: [org.apache.commons.pool2.impl.DefaultEvictionPolicy]
does not implement EvictionPolicy}}
> {{    at org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:618)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.setConfig(GenericObjectPool.java:318)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:115)}}
> {{    at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:88)}}
>  
> Version 2.5.0 throws the same exception. Version 2.4.2 or older's setEvictionPolicyClassName
method fail silently for the same reason. This line in BaseGenericObjectPool evaluates to
false for all versions:
> {{        if (policy instanceof EvictionPolicy<?>) {}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message