Re: [configuration] 1.10 regression / backwards-incompatible change in MapConfiguration.convertPropertiesToMap ?

2016-01-10 Thread Oliver Heger
Hi,

Am 07.01.2016 um 20:33 schrieb Norbert Kiesel:
> Hi,
> 
> 
> we just tried to upgrade from commons-configuration-1.9 to 
> commons-configuration-1.10 and hit a blocking problem.  It manifests itself 
> as:
> 
> java.lang.UnsupportedOperationException
> at java.util.AbstractMap.put(AbstractMap.java:209)
> at 
> org.apache.commons.configuration.MapConfiguration.addPropertyDirect(MapConfiguration.java:186)
> at 
> org.apache.commons.configuration.AbstractConfiguration.addPropertyValues(AbstractConfiguration.java:423)
> at 
> org.apache.commons.configuration.AbstractConfiguration.addProperty(AbstractConfiguration.java:393)
> at 
> org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:486)
> 
> 
> 
> Looks like this happens because the map was created using the 
> `MapConfiguration(Properties props)` constructor.  In 1.9, this creates a 
> HashMap and fills it with the properties.  In 1.10, this now uses an 
> AbstractMap that only overrides `entrySet` which makes this a read-only map.
> 
> 
> Our code then tries to add more properties, which produces the above 
> exception.
> 
> 
> Are we doing something wrong here or is this really a regression in 1.10?
> 

This seems to be a regression in 1.10, unfortunately. According to SVN
history, the code in MapConfiguration has been patched to fix
CONFIGURATION-556 [1]. The fact that the MapConfiguration can no longer
be updated is probably an undesired side effect.

I assume that this will work again with version 2.0. In this version,
MapConfiguration just stores the Properties object passed to the
constructor. So updates are not a problem.

Oliver

[1] https://issues.apache.org/jira/browse/CONFIGURATION-556

> 
> 
> 
> 
> 
> ---
> 
> 
> Norbert Kiesel
> Systems Architect | Engineering
> MetricStream
> 2600 E. Bayshore Road | Palo Alto, CA - 94303
> +1-650-620-2954 | nkie...@metricstream.com | www.metricstream.com
> 
> Confidentiality Notice:This email and any files transmitted with it are 
> confidential and intended solely for the use of the individual or entity to 
> whom they are addressed. This message contains confidential information and 
> is intended only for the individual named. If you are not the named addressee 
> you should not disseminate, distribute or copy this e-mail. Please notify the 
> sender immediately by e-mail if you have received this e-mail by mistake and 
> delete this e-mail from your system. If you are not the intended recipient 
> you are notified that disclosing, copying, distributing or taking any action 
> in reliance on the contents of this information is strictly prohibited
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] 1.10 regression / backwards-incompatible change in MapConfiguration.convertPropertiesToMap ?

2016-01-10 Thread Norbert Kiesel
Any chance we will see a 1.11?

At least 1.10 release notes should be updated to note this, no? Right now it 
claims to be 100 backwards compatible.

On Jan 10, 2016 11:34 AM, Oliver Heger  wrote:
Hi,

Am 07.01.2016 um 20:33 schrieb Norbert Kiesel:
> Hi,
>
>
> we just tried to upgrade from commons-configuration-1.9 to 
> commons-configuration-1.10 and hit a blocking problem.  It manifests itself 
> as:
>
> java.lang.UnsupportedOperationException
> at java.util.AbstractMap.put(AbstractMap.java:209)
> at 
> org.apache.commons.configuration.MapConfiguration.addPropertyDirect(MapConfiguration.java:186)
> at 
> org.apache.commons.configuration.AbstractConfiguration.addPropertyValues(AbstractConfiguration.java:423)
> at 
> org.apache.commons.configuration.AbstractConfiguration.addProperty(AbstractConfiguration.java:393)
> at 
> org.apache.commons.configuration.AbstractConfiguration.setProperty(AbstractConfiguration.java:486)
>
>
>
> Looks like this happens because the map was created using the 
> `MapConfiguration(Properties props)` constructor.  In 1.9, this creates a 
> HashMap and fills it with the properties.  In 1.10, this now uses an 
> AbstractMap that only overrides `entrySet` which makes this a read-only map.
>
>
> Our code then tries to add more properties, which produces the above 
> exception.
>
>
> Are we doing something wrong here or is this really a regression in 1.10?
>

This seems to be a regression in 1.10, unfortunately. According to SVN
history, the code in MapConfiguration has been patched to fix
CONFIGURATION-556 [1]. The fact that the MapConfiguration can no longer
be updated is probably an undesired side effect.

I assume that this will work again with version 2.0. In this version,
MapConfiguration just stores the Properties object passed to the
constructor. So updates are not a problem.

Oliver

[1] https://issues.apache.org/jira/browse/CONFIGURATION-556

>
>
>
> 
>
> ---
>
>
> Norbert Kiesel
> Systems Architect | Engineering
> MetricStream
> 2600 E. Bayshore Road | Palo Alto, CA - 94303
> +1-650-620-2954 | nkie...@metricstream.com | 
> www.metricstream.com
>
> Confidentiality Notice:This email and any files transmitted with it are 
> confidential and intended solely for the use of the individual or entity to 
> whom they are addressed. This message contains confidential information and 
> is intended only for the individual named. If you are not the named addressee 
> you should not disseminate, distribute or copy this e-mail. Please notify the 
> sender immediately by e-mail if you have received this e-mail by mistake and 
> delete this e-mail from your system. If you are not the intended recipient 
> you are notified that disclosing, copying, distributing or taking any action 
> in reliance on the contents of this information is strictly prohibited
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [dbcp]the activity when number of active connections reach (maxActive-minIdle)

2016-01-10 Thread Phil Steitz
On Fri, Jan 8, 2016 at 10:27 PM, sum2000  wrote:

> for example,pool size:
> db.pool.size.init=5
> db.pool.size.active.max=20
> db.pool.size.idle.max=20
> db.pool.size.idle.min=10
> when # of active connections reach 10, what's the following activity of
> dbcp?
> We know it can’t create new one for idle due to no availabe pool resource,
> if true dbcp can’t keep minIdle for 10, so what's next happen?
>

The maxTotal [1] property is a hard limit on the total number of
connections that can be open under management by the pool at a given time
(checked out or idle).  The minIdle property really expresses an objective,
not a guarantee.  In the situation you describe, the number of idle
connections will drop down below minIdle.

Another thing to note is that as of version 2.1 of DBCP, as indicated in
the javadoc for minIdle, the pool only attempts to ensure minIdle when the
evictor runs, so unless you have timeBetweenEvictionRunsMillis set to a
positive value, there will be no attempt by the pool to ensure minIdle.

Phil

[1] In DBCP 1.x, this property is named "maxActive".

>
>
> Thank you.
> Yong Fu