Add remove
to connection pool's Lease
interface.
#4680
Labels
remove
to connection pool's Lease
interface.
#4680
Describe the feature
Add a
remove
method toio.vertx.core.net.impl.pool.Lease
that allows leaseholders to remove the leased object instead of recycling it to the pool. A client would callremove
instead ofrecycle
when they determine the leased object should no longer be used.The goal is to allow clients of the pool to make deterministic decisions on wether a leased object should be returned or recycled.
Use cases
SqlConnectionPool
evictions are now (#1298) tested for idle time and max lifetime. Additionally, the eviction process is periodic and only checks "slots" that are not actively in use. Generally this works fine.This leaves the problem of pools under heavy load. In this scenario there is no guarantee that eviction will ever be able to check for max lifetime because all connections might be in use when the eviction check is run.
During the
SqlConnectionPool.PooledConnection
"close" we know if the connection has exceeded its maximum lifetime but there is no way to hold the lease (so it's not recycled) and close/remove the connection from the pool.With an added
remove
method,PooledConnection
could communicate this removal requirement to the pool as it encounters it.Contribution
I am willing to implement the feature or pass it off to @tsegismont or @vietj.
The text was updated successfully, but these errors were encountered: