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

[SimpleConnectionPool] Add release option to connection pool Lease #4736

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

Commits on Jun 13, 2023

  1. [SimpleConnectionPool] Add release option to connection pool Lease

    This PR tries to implement eclipse-vertx#4680.
    A new method, release(Handler<AsyncResult<T>> handler) is added to the Lease
    interface, with the default implementation calling recycle().
    
    In SimpleConnectionPool, LeaseImpl implements the release() method by invoking
    slot.pool.release().
    
    The release() method in the Pool reduces slot.usage by 1, and if the usage count
    reaches 0, it invokes pool.remove(slot).
    
    The PR also introduces another member variable within the Slot object, called
    inactive (boolean). When release() is invoked on a slot, the slot is marked as
    inactive irrespective of the usage count. inactive is also set to true in Evict,
    before we remove the slot (when usage count is 0).
    
    A new Slot is initialized with inactive as true. The only time inactive gets set
    to false is when a connection is successfully established for the slot.
    
    In pool.acquire, we skip slots that are marked as inactive. This behavior means
    it is better to invoke pool.connect() whenever a slot is removed, even when
    there are no Waiters. This change will be made in a follow-up PR.
    
    release() can subsequently be used by SqlConnectionPool instead of recycle(),
    when it determines that a given connection is past its maxLifetime (else it uses
    recycle()).
    chandramouli-r committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    0edfe63 View commit details
    Browse the repository at this point in the history