From: sergiyvamz (@sergiyvamz) <noreply+sergiyvamz@github.com>
To: aws/aws-advanced-jdbc-wrapper <noreply+aws-aws-advanced-jdbc-wrapper@github.com>
Subject: [aws/aws-advanced-jdbc-wrapper] PR #2257: feat: evict expired and aborted connections from internal pools
Date: Wed, 18 Nov 2026 18:19:33 +0000
Message-ID: <gh-aws-aws-advanced-jdbc-wrapper-2257@github.com> (raw)
### Summary
Evict expired and aborted connections from the internal connection pool.
### Description
With `HikariPooledConnectionProvider`, closing a connection only returns the physical connection to the pool. When the connectionLifetime plugin closes an expired connection, the same physical connection is handed out again with a fresh timer. EFM-aborted connections can also be handed out again until Hikari notices they are dead.
- New `ConnectionProvider#evictConnection(Connection)` (default no-op) and `PluginService#evictConnection(Connection)`.
- `HikariPooledConnectionProvider` remembers which pool issued each connection and calls `HikariDataSource#evictConnection` on it.
- The connectionLifetime plugin evicts the expired connection once it is closed. Connections another plugin preserved are left alone.
- EFM v1, v2 and v3 evict a connection after aborting it.
- `C3P0PooledConnectionProvider` keeps the no-op: c3p0 has no public API to evict a single connection.
### Additional Reviewers
### By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.