vertx-sql-client icon indicating copy to clipboard operation
vertx-sql-client copied to clipboard

connectionReleaseDelay PoolOption

Open julianladisch opened this issue 4 years ago • 6 comments

Close idle connections that wait in the pool for connectionReleaseDelay milliseconds. Defaults to 0 = keep them forever.

The option name is taken from vertx-mysql-postgresql-client: https://github.com/vert-x3/vertx-mysql-postgresql-client/blob/3.9.1/vertx-mysql-postgresql-client-jasync/src/main/java/io/vertx/ext/asyncsql/impl/pool/AsyncConnectionPool.java#L68

Implementation If connectionReleaseDelay is > 0: When a connection is put into the pool create a timer that closes the connection and removes it from the pool: expire(). If a connection in the pool is acquired before the timer fires the timer is cancelled: cancelIdleTimer().

In PoolOptions

  • add connectionReleaseDelay option
  • fix and unit test equals() and hashCode()

In ConnectionPool

  • add constructor that takes PoolOptions to avoid long parameter lists
  • add package-private allSize() for unit testing
  • rename and move release(PooledConnection) to PooledConnection.addToPool() to avoid a name that is misleading if connectionReleaseDelay exists

julianladisch avatar Jul 03 '20 16:07 julianladisch

the pool should be reimplemented before 4.0 or around, so I would rather do that in the new pool rather than adding this here

vietj avatar Jul 10 '20 07:07 vietj

We use and will use the old pool in production and therefore would like to have this merged upstream (= in eclipse-vertx/vertx-sql-client) to avoid maintaining a fork.

julianladisch avatar Jul 11 '20 21:07 julianladisch

@vietj Is the code quality of this pull request too low, or is the scheduled pool re-implementation the only reason?

julianladisch avatar Jul 28 '20 13:07 julianladisch

@vietj What needs to be changed to get this merged to eclipse-vertx/vertx-sql-client?

julianladisch avatar Aug 27 '20 07:08 julianladisch

at least connectionReleaseDelay that might not be part of the next options for this pool

vietj avatar Aug 27 '20 18:08 vietj

it is rescheduled reimplementation based on the vertx HTTP pool but that would be in 4.1 or 4.2

vietj avatar Aug 27 '20 18:08 vietj