Skip to content

Commit

Permalink
avoid unnecessary calls to ConcurrentLinkedDeque.size() which is a no…
Browse files Browse the repository at this point in the history
…n-constant-time operation (#9922)
  • Loading branch information
s15r authored Sep 29, 2023
1 parent c8c9540 commit 74097a6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ final void onConnectionInactive2(ResizerConnection connection) {
}

final void addPendingRequest(PoolSink<ConnectionManager.PoolHandle> sink) {
if (pendingRequests.size() >= connectionPoolConfiguration.getMaxPendingAcquires()) {
int maxPendingAcquires = connectionPoolConfiguration.getMaxPendingAcquires();
if (maxPendingAcquires != Integer.MAX_VALUE && pendingRequests.size() >= maxPendingAcquires) {
sink.tryEmitError(new HttpClientException("Cannot acquire connection, exceeded max pending acquires configuration"));
return;
}
Expand Down

0 comments on commit 74097a6

Please sign in to comment.