vertx-sql-client
vertx-sql-client copied to clipboard
connectionReleaseDelay PoolOption
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
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
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.
@vietj Is the code quality of this pull request too low, or is the scheduled pool re-implementation the only reason?
@vietj What needs to be changed to get this merged to eclipse-vertx/vertx-sql-client?
at least connectionReleaseDelay
that might not be part of the next options for this pool
it is rescheduled reimplementation based on the vertx HTTP pool but that would be in 4.1 or 4.2