Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connectionReleaseDelay PoolOption #710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julianladisch
Copy link
Contributor

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

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/AsyncC$

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

Signed-off-by: Julian Ladisch <eclipse.org-rtn@ladisch.de>
@vietj
Copy link
Member

vietj commented Jul 10, 2020

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

@julianladisch
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@julianladisch
Copy link
Contributor Author

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

@vietj
Copy link
Member

vietj commented Aug 27, 2020

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

@vietj
Copy link
Member

vietj commented Aug 27, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants