On 1/24/2017 3:55 PM, Romero, René wrote:
> We're running  commons-dbcp-1.4 and commons-pool-1.6. To me, it sounds like 
> we're being impacted by this bug:
>
> https://issues.apache.org/jira/browse/DBCP-379
>
> [DBCP-379] number of connections created has crossed more 
> ...<https://issues.apache.org/jira/browse/DBCP-379>
> issues.apache.org
> I found that when the minIdle is configured then during loads, common pool 
> creates more number of connections it will be greater than maxActive.
>
> Is it transparent application-wise to jump from these versions to the 
> latests? Or what upgrading path do you suggest we take?

I don't know anything about that bug or whether that is what you are
encountering, but I can discuss upgrading.

You seem to be on the latest 1.x versions.  Upgrading to the 2.x
versions will require code changes, because the package names have
changed.  A few other things have changed as well.

When I did the upgrade, I found it to be pretty easy to make the
conversion.  Changing the imports was a big part of the job, which my
IDE (eclipse) basically did for me.  A few changes were also required
when building the datasource objects.

Here's a slightly redacted patch that shows the code changes I made when
I upgraded POOL and DBCP from 1.x to 2.x:

https://www.dropbox.com/s/de1hpa767i8tg5s/dbcp2-upgrade.patch?dl=0

This upgrade was done nearly two years ago, but I think I remember
enough about it that I may be able to answer questions on the patch.

The code went through a whole bunch of changes after the upgrade.  I
changed "replica" to "main" throughout the class.  The "replica database
server" section that you can see in the patch now looks like the following:

  /*
   * Create a datasource (connection pool) for the main database server.
   */
  ConnectionFactory cfMain = new DriverManagerConnectionFactory(mainUrl,
dbUser, dbPass);
  PoolableConnectionFactory pcfMain = new
PoolableConnectionFactory(cfMain, null);
  pcfMain.setValidationQuery(validationQuery);
  pcfMain.setValidationQueryTimeout(Const.FIVE_SECONDS / 1000);
  opMain = new GenericObjectPool<>(pcfMain);
  opMain.setMaxWaitMillis(Const.THIRTY_SECONDS);
  opMain.setMaxIdle(numShards);
  opMain.setMaxTotal(numShards * 5);
  opMain.setNumTestsPerEvictionRun(numShards * 5);
  opMain.setTimeBetweenEvictionRunsMillis(Const.ONE_MINUTE);
  opMain.setMinEvictableIdleTimeMillis(Const.ONE_MINUTE * 5);
  pcfMain.setPool(opMain);
  dsMain = new PoolingDataSource<>(opMain);

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to