Skip to content

Commit

Permalink
HTTPCLIENT-2314: Throw ConnectionShutdownException in case of pooled …
Browse files Browse the repository at this point in the history
…connection having been closed or discarded instead of plain IllegalStateException
  • Loading branch information
ok2c committed Jan 5, 2024
1 parent 7d853d5 commit 67519a1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
import org.apache.hc.core5.pool.PoolStats;
import org.apache.hc.core5.pool.StrictConnPool;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.Asserts;
import org.apache.hc.core5.util.Deadline;
import org.apache.hc.core5.util.Identifiable;
import org.apache.hc.core5.util.TimeValue;
Expand Down Expand Up @@ -665,7 +664,9 @@ PoolEntry<HttpRoute, ManagedHttpClientConnection> getPoolEntry() {
PoolEntry<HttpRoute, ManagedHttpClientConnection> getValidatedPoolEntry() {
final PoolEntry<HttpRoute, ManagedHttpClientConnection> poolEntry = getPoolEntry();
final ManagedHttpClientConnection connection = poolEntry.getConnection();
Asserts.check(connection != null && connection.isOpen(), "Endpoint is not connected");
if (connection == null || !connection.isOpen()) {
throw new ConnectionShutdownException();
}
return poolEntry;
}

Expand Down

0 comments on commit 67519a1

Please sign in to comment.