Pooling managers: offload connection disposal from the pool lock.#726
Conversation
|
@arturobernalg This functionality is necessary for the classic connection management only where connections can get blocked in the Please reduce the scope to |
067a831 to
14b0b39
Compare
Done |
5ce8a9b to
97a89e9
Compare
3f19818 to
1094717
Compare
| * delegating the actual close to {@link DefaultDisposalCallback}. | ||
| */ | ||
| @Internal | ||
| final class AsyncDisposalCallback<C extends SocketModalCloseable> |
b59ab28 to
358ffcc
Compare
| @@ -409,6 +415,7 @@ public ConnectionEndpoint get( | |||
| } | |||
| } finally { | |||
| lock.unlock(); | |||
There was a problem hiding this comment.
@arturobernalg This is a lease lock., not a global pool lock. It is perfectly OK to call #drainDisposals inside the method, for instance, at line 395 (prior to final ManagedHttpClientConnection conn = poolEntry.getConnection();)
There was a problem hiding this comment.
@arturobernalg This is a lease lock., not a global pool lock. It is perfectly OK to call
#drainDisposalsinside the method, for instance, at line 395 (prior tofinal ManagedHttpClientConnection conn = poolEntry.getConnection();)
@ok2c drainDisposals() now runs inside LeaseRequest#get right before poolEntry.getConnection() (lease lock only), with the final safety drain retained; tests updated accordingly.
There was a problem hiding this comment.
@arturobernalg The chances of anything going wrong in the remaining code is super-slim. And if it did happen the queue would get drained by another call / thread. But I think one #drainDisposals call should be enough here. Pick one you prefer. I leave it up to you.
3067c67 to
a98dd51
Compare
6b8827d to
050b7d9
Compare
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg Now the big question is whether this approach is stable enough to be activated by default or shall we mark it experimental and make optional in 5.6 release series?
35be10e to
05042bc
Compare
@ok2c |
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg Looks good to me.
…EFUL, run IMMEDIATE inline Drain queue after lease/release/closeExpired/closeIdle to avoid holding the pool lock
05042bc to
16c9d81
Compare
Close sockets off the pool lock via an async disposer. Improves lease latency under eviction/state mismatch with slow close.Includes classic/async tests and default-disposer baseline.