Apache Common Pools migration from version 1 to version 2 and the exhausted actions

623 Views Asked by At

In Apache Commons Pool 1, the class GenericObjectPool had the possibility to define three actions to react to an exhausted pool:

  • Fail
  • Block
  • Grow

Now, in version 2 I do not see these three options and the class GenericObjectPool seems to have only the possibility to specify if the pool must block or not when exhausted.

According with method borrowObject, it seems that the block when exhausted option only allows for covering actions FAIL and BLOCK. But how can I make the pool follow the GROW action?

1

There are 1 best solutions below

0
On

I've found in the changelog

Remove WhenExhuastedAction.GROW since it is equivalent to WhenExhuastedAction.FAIL with a maxActive value of Integer.MAX_VALUE

Therefore it should be possible to make it with the above configuration.